@chainvue/verus-sdk 0.13.0 → 0.14.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/README.md +21 -8
- package/dist/VerusSDK.d.ts +34 -1
- package/dist/VerusSDK.d.ts.map +1 -1
- package/dist/VerusSDK.js +38 -1
- package/dist/VerusSDK.js.map +1 -1
- package/dist/bundle.js +1009 -122
- package/dist/currency/definition.d.ts +181 -0
- package/dist/currency/definition.d.ts.map +1 -0
- package/dist/currency/definition.js +396 -0
- package/dist/currency/definition.js.map +1 -0
- package/dist/currency/index.d.ts +17 -7
- package/dist/currency/index.d.ts.map +1 -1
- package/dist/currency/index.js +32 -9
- package/dist/currency/index.js.map +1 -1
- package/dist/currency/launch.d.ts +43 -0
- package/dist/currency/launch.d.ts.map +1 -0
- package/dist/currency/launch.js +96 -0
- package/dist/currency/launch.js.map +1 -0
- package/dist/currency/outputs.d.ts +40 -0
- package/dist/currency/outputs.d.ts.map +1 -0
- package/dist/currency/outputs.js +296 -0
- package/dist/currency/outputs.js.map +1 -0
- package/dist/currency/reserveTransfer.d.ts +36 -0
- package/dist/currency/reserveTransfer.d.ts.map +1 -0
- package/dist/currency/reserveTransfer.js +104 -0
- package/dist/currency/reserveTransfer.js.map +1 -0
- package/dist/currency/wire.d.ts +76 -0
- package/dist/currency/wire.d.ts.map +1 -0
- package/dist/currency/wire.js +252 -0
- package/dist/currency/wire.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/transfer/index.d.ts.map +1 -1
- package/dist/transfer/index.js +38 -14
- package/dist/transfer/index.js.map +1 -1
- package/dist/types/index.d.ts +27 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ReserveTransferParams {
|
|
2
|
+
/** Reserve currency being sent — the chain's native currency i-address. */
|
|
3
|
+
sourceCurrency: string;
|
|
4
|
+
/** Amount of `sourceCurrency` in satoshis. */
|
|
5
|
+
amount: bigint;
|
|
6
|
+
/** The fractional/launching currency to (pre)convert into. */
|
|
7
|
+
destCurrency: string;
|
|
8
|
+
/** i-address that receives the converted currency. */
|
|
9
|
+
recipient: string;
|
|
10
|
+
/**
|
|
11
|
+
* Refund/return i-address carried as the transfer's auxiliary destination — the
|
|
12
|
+
* daemon sets this to the sending address. Defaults to `recipient`.
|
|
13
|
+
*/
|
|
14
|
+
refundAddress?: string;
|
|
15
|
+
/** Conversion fee in satoshis (fee currency defaults to `sourceCurrency`). */
|
|
16
|
+
feeAmount: bigint;
|
|
17
|
+
/** Fee currency i-address. Defaults to `sourceCurrency`. */
|
|
18
|
+
feeCurrency?: string;
|
|
19
|
+
/**
|
|
20
|
+
* `true` for a pre-convert (only valid before the currency's start block —
|
|
21
|
+
* "invest at launch"), `false` for a market convert into a live currency.
|
|
22
|
+
*/
|
|
23
|
+
preconvert?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A reserve-transfer output: its scriptPubKey hex and native satoshi value (amount + fee). */
|
|
26
|
+
export interface ReserveTransferBuildResult {
|
|
27
|
+
script: string;
|
|
28
|
+
value: bigint;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the EVAL_RESERVE_TRANSFER output that (pre)converts native reserve into a
|
|
32
|
+
* fractional currency — byte-equivalent to what `sendcurrency` produces. Returns
|
|
33
|
+
* the output script and the native value it must carry (amount + fee).
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildReserveTransferOutput(params: ReserveTransferParams): ReserveTransferBuildResult;
|
|
36
|
+
//# sourceMappingURL=reserveTransfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reserveTransfer.d.ts","sourceRoot":"","sources":["../../src/currency/reserveTransfer.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+FAA+F;AAC/F,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,qBAAqB,GAAG,0BAA0B,CA2DpG"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildReserveTransferOutput = buildReserveTransferOutput;
|
|
7
|
+
/**
|
|
8
|
+
* Reserve-transfer output builder — the output that converts or *pre*converts a
|
|
9
|
+
* reserve currency into a fractional/launching currency. A pre-convert is how you
|
|
10
|
+
* "invest" in a currency during its pre-launch window: you send a reserve (e.g.
|
|
11
|
+
* native VRSCTEST) to the launching currency and receive its fractional currency
|
|
12
|
+
* when it launches.
|
|
13
|
+
*
|
|
14
|
+
* The wire format is `verus-typescript-primitives`' `ReserveTransfer` (verified to
|
|
15
|
+
* round-trip and rebuild live daemon output byte-for-byte, single-value mode)
|
|
16
|
+
* wrapped in the EVAL_RESERVE_TRANSFER (=8) CryptoCondition output, whose
|
|
17
|
+
* destination is the reserve-transfer contract's KeyID (like the import output,
|
|
18
|
+
* TYPE_PKH not TYPE_PK). Byte-locked against a live `sendcurrency ...
|
|
19
|
+
* returntxtemplate` reference — see test/currency-reserve-transfer.test.ts.
|
|
20
|
+
*
|
|
21
|
+
* Scope: sending the chain's native reserve into a fractional currency (the
|
|
22
|
+
* common "invest at launch" path). The native output value is amount + fee.
|
|
23
|
+
*/
|
|
24
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
25
|
+
const boundary_js_1 = require("../fork/boundary.js");
|
|
26
|
+
const errors_js_1 = require("../errors.js");
|
|
27
|
+
const brands_js_1 = require("../core/brands.js");
|
|
28
|
+
const wire_js_1 = require("./wire.js");
|
|
29
|
+
const EVAL_RESERVE_TRANSFER = 8;
|
|
30
|
+
// Hash160 of the EVAL_RESERVE_TRANSFER contract pubkey — the output's KeyID
|
|
31
|
+
// destination (chain-independent, `src/cc/CCcustom.cpp`).
|
|
32
|
+
const RESERVE_TRANSFER_KEYHASH = Buffer.from('cb8a0f7f651b484a81e2312c3438deb601e27368', 'hex');
|
|
33
|
+
// The daemon's minimum reserve-transfer fee (0.0002 native; GetTransactionTransferFee).
|
|
34
|
+
const MIN_TRANSFER_FEE = 20000n;
|
|
35
|
+
// ReserveTransfer flag bits.
|
|
36
|
+
const RT_VALID = 1;
|
|
37
|
+
const RT_CONVERT = 2;
|
|
38
|
+
const RT_PRECONVERT = 4;
|
|
39
|
+
// TransferDestination: DEST_ID with an auxiliary destination — the convention
|
|
40
|
+
// `sendcurrency` emits (the aux dest mirrors the recipient).
|
|
41
|
+
const DEST_ID = 4;
|
|
42
|
+
const FLAG_DEST_AUX = 0x40;
|
|
43
|
+
/**
|
|
44
|
+
* Build the EVAL_RESERVE_TRANSFER output that (pre)converts native reserve into a
|
|
45
|
+
* fractional currency — byte-equivalent to what `sendcurrency` produces. Returns
|
|
46
|
+
* the output script and the native value it must carry (amount + fee).
|
|
47
|
+
*/
|
|
48
|
+
function buildReserveTransferOutput(params) {
|
|
49
|
+
if (params.amount <= 0n) {
|
|
50
|
+
throw new errors_js_1.TransactionBuildError('amount must be positive');
|
|
51
|
+
}
|
|
52
|
+
// The daemon's minimum transfer fee (GetTransactionTransferFee, pbaas.cpp): a
|
|
53
|
+
// reserve transfer paying less is rejected. The exact fee for a given amount is
|
|
54
|
+
// computed by the node — query it (e.g. `sendcurrency … returntxtemplate`) and
|
|
55
|
+
// pass it here; this only guards the floor.
|
|
56
|
+
if (params.feeAmount < MIN_TRANSFER_FEE) {
|
|
57
|
+
throw new errors_js_1.TransactionBuildError(`feeAmount must be at least ${MIN_TRANSFER_FEE} (the daemon's minimum transfer fee), got ${params.feeAmount}`);
|
|
58
|
+
}
|
|
59
|
+
// Every address MUST be a currency/identity i-address. The transfer destination
|
|
60
|
+
// is encoded as DEST_ID, so an R-address recipient would silently become an
|
|
61
|
+
// identity id equal to that hash160 — almost certainly a nonexistent identity —
|
|
62
|
+
// and the converted funds would be unrecoverable. parseIAddress rejects a
|
|
63
|
+
// non-i-address (wrong version byte or bad checksum) fail-closed. The currency
|
|
64
|
+
// ids get the same check so a wrong-typed address can't become a wrong currency.
|
|
65
|
+
(0, brands_js_1.parseIAddress)(params.sourceCurrency, 'sourceCurrency');
|
|
66
|
+
(0, brands_js_1.parseIAddress)(params.destCurrency, 'destCurrency');
|
|
67
|
+
(0, brands_js_1.parseIAddress)(params.recipient, 'recipient');
|
|
68
|
+
if (params.refundAddress !== undefined) {
|
|
69
|
+
(0, brands_js_1.parseIAddress)(params.refundAddress, 'refundAddress');
|
|
70
|
+
}
|
|
71
|
+
const feeCurrency = params.feeCurrency ?? params.sourceCurrency;
|
|
72
|
+
(0, brands_js_1.parseIAddress)(feeCurrency, 'feeCurrency');
|
|
73
|
+
// Native-reserve scope: the output value is amount + fee in a single currency,
|
|
74
|
+
// so a different fee currency would make that value wrong. Require them equal.
|
|
75
|
+
if (feeCurrency !== params.sourceCurrency) {
|
|
76
|
+
throw new errors_js_1.TransactionBuildError('feeCurrency must equal sourceCurrency (this builder handles native-reserve transfers only)');
|
|
77
|
+
}
|
|
78
|
+
const flags = RT_VALID | RT_CONVERT | (params.preconvert ? RT_PRECONVERT : 0);
|
|
79
|
+
const transfer = new boundary_js_1.ReserveTransfer({
|
|
80
|
+
// Single-value mode (multivalue:false) — the daemon's encoding for a
|
|
81
|
+
// single-currency transfer: currency id + VARINT amount, no count prefix.
|
|
82
|
+
values: new boundary_js_1.CurrencyValueMap({
|
|
83
|
+
value_map: new Map([[params.sourceCurrency, new bn_js_1.default(params.amount.toString())]]),
|
|
84
|
+
multivalue: false,
|
|
85
|
+
}),
|
|
86
|
+
version: new bn_js_1.default(1),
|
|
87
|
+
flags: new bn_js_1.default(flags),
|
|
88
|
+
fee_currency_id: feeCurrency,
|
|
89
|
+
fee_amount: new bn_js_1.default(params.feeAmount.toString()),
|
|
90
|
+
transfer_destination: boundary_js_1.TransferDestination.fromJson({
|
|
91
|
+
type: DEST_ID | FLAG_DEST_AUX,
|
|
92
|
+
address: params.recipient,
|
|
93
|
+
auxdests: [{ type: DEST_ID, address: params.refundAddress ?? params.recipient }],
|
|
94
|
+
}),
|
|
95
|
+
dest_currency_id: params.destCurrency,
|
|
96
|
+
});
|
|
97
|
+
const script = (0, wire_js_1.wrapCcOutput)(EVAL_RESERVE_TRANSFER, [transfer.toBuffer()], {
|
|
98
|
+
kind: 'keyid',
|
|
99
|
+
hash: RESERVE_TRANSFER_KEYHASH,
|
|
100
|
+
}).toString('hex');
|
|
101
|
+
// For a native-reserve transfer the output carries the amount plus the fee.
|
|
102
|
+
return { script, value: params.amount + params.feeAmount };
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=reserveTransfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reserveTransfer.js","sourceRoot":"","sources":["../../src/currency/reserveTransfer.ts"],"names":[],"mappings":";;;;;AA6EA,gEA2DC;AAxID;;;;;;;;;;;;;;;;GAgBG;AACH,kDAAuB;AACvB,qDAA6F;AAC7F,4CAAqD;A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F,gBAAgB,EAAE,MAAM,CAAC,YAAY;KACtC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,qBAAqB,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE;QACxE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,wBAAwB;KAC/B,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEnB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const SATOSHIDEN = 100000000n;
|
|
2
|
+
export declare const INT32_MIN = -2147483648;
|
|
3
|
+
export declare const INT32_MAX = 2147483647;
|
|
4
|
+
export declare const ZEROS_32: Buffer<ArrayBuffer>;
|
|
5
|
+
/** Assert a bigint fits a non-negative int32 (VARINT-encoded int32 ratio fields). */
|
|
6
|
+
export declare function requireInt32Range(value: bigint, label: string): bigint;
|
|
7
|
+
/** Assert a bigint fits a non-negative int64 (VARINT-encoded CAmount fee fields). */
|
|
8
|
+
export declare function requireInt64Range(value: bigint, label: string): bigint;
|
|
9
|
+
/** Little-endian int16 (uint16 domain — flags/versions are small non-negative). */
|
|
10
|
+
export declare function uint16LE(value: number, label: string): Buffer;
|
|
11
|
+
/** Little-endian int32. */
|
|
12
|
+
export declare function int32LE(value: number, label: string): Buffer;
|
|
13
|
+
/** Little-endian uint32. */
|
|
14
|
+
export declare function uint32LE(value: number, label: string): Buffer;
|
|
15
|
+
/** Little-endian signed int64. */
|
|
16
|
+
export declare function int64LE(value: bigint, label: string): Buffer;
|
|
17
|
+
/**
|
|
18
|
+
* Bitcoin/Verus `VARINT` (serialize.h `WriteVarInt`): base-128, MSB continuation,
|
|
19
|
+
* most-significant group first. Distinct from the CompactSize used for vector
|
|
20
|
+
* lengths. Non-negative only (all VARINT fields here are counts/fees/heights).
|
|
21
|
+
*/
|
|
22
|
+
export declare function varInt(value: bigint, label: string): Buffer;
|
|
23
|
+
/** LIMITED_STRING: CompactSize length + UTF-8 bytes. */
|
|
24
|
+
export declare function limitedString(value: string, maxLen: number, label: string): Buffer;
|
|
25
|
+
/** A uint160 i-address on the wire: its raw 20-byte hash, no length prefix. */
|
|
26
|
+
export declare function uint160(iAddress: string, label: string): Buffer;
|
|
27
|
+
/** A pre-hashed uint160 (20 raw bytes), validated for length. */
|
|
28
|
+
export declare function uint160Raw(hash: Buffer, label: string): Buffer;
|
|
29
|
+
/** A uint256 (32 raw bytes), validated for length. */
|
|
30
|
+
export declare function uint256Raw(hash: Buffer, label: string): Buffer;
|
|
31
|
+
/** CompactSize-counted vector of uint160 i-addresses. */
|
|
32
|
+
export declare function vectorU160(addresses: string[], label: string): Buffer;
|
|
33
|
+
/** CompactSize-counted vector of little-endian int64 amounts. */
|
|
34
|
+
export declare function vectorI64(values: bigint[], label: string): Buffer;
|
|
35
|
+
/**
|
|
36
|
+
* CompactSize-counted vector of little-endian int32 values (weights). Weights are
|
|
37
|
+
* int32 on the wire, so `Number(v)` is exact here — any bigint that would lose
|
|
38
|
+
* precision (> 2^53) is far above INT32_MAX and rejected by `int32LE` first.
|
|
39
|
+
*/
|
|
40
|
+
export declare function vectorI32(values: bigint[], label: string): Buffer;
|
|
41
|
+
/**
|
|
42
|
+
* `CCurrencyValueMap` wire format: CompactSize(n) + n·(uint160 + int64). Entries
|
|
43
|
+
* must already be sorted by currency id the way the daemon emits them; callers
|
|
44
|
+
* here pass single-entry or empty maps, so ordering is not a concern yet.
|
|
45
|
+
*/
|
|
46
|
+
export declare function currencyValueMap(entries: Array<{
|
|
47
|
+
hash: Buffer;
|
|
48
|
+
amount: bigint;
|
|
49
|
+
}>, label: string): Buffer;
|
|
50
|
+
/**
|
|
51
|
+
* Normalize raw relative reserve weights to canonical weights summing to
|
|
52
|
+
* exactly SATOSHIDEN (1e8), reproducing `definecurrency` byte-for-byte
|
|
53
|
+
* (`CCurrencyDefinition(UniValue)`, VerusCoin `src/pbaas/crosschainrpc.cpp`):
|
|
54
|
+
* each weight becomes `floor(1e8 · raw[i] / Σraw)`, and the last currency — or
|
|
55
|
+
* any earlier one whose share would overrun what remains — absorbs the leftover
|
|
56
|
+
* so the vector sums to precisely 1e8. Byte-locked against the daemon for even
|
|
57
|
+
* and uneven splits (see test/currency-definition.test.ts).
|
|
58
|
+
*/
|
|
59
|
+
export declare function normalizeWeights(raw: bigint[]): bigint[];
|
|
60
|
+
/** The CC destination kinds a currency-launch output uses. */
|
|
61
|
+
export type CcDestination = {
|
|
62
|
+
kind: 'pubkey';
|
|
63
|
+
pubkey: Buffer;
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'keyid';
|
|
66
|
+
hash: Buffer;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Wrap serialized data in a Verus CryptoCondition output script:
|
|
70
|
+
* `OptCCParams(master, eval 0) OP_CHECKCRYPTOCONDITION OptCCParams(params, evalCode) OP_DROP`,
|
|
71
|
+
* both m=1/n=1 to a single fixed destination. This is the shape every CC output
|
|
72
|
+
* in a currency-definition transaction uses; the eval code, destination, and
|
|
73
|
+
* payload vary per output.
|
|
74
|
+
*/
|
|
75
|
+
export declare function wrapCcOutput(evalCode: number, vdata: Buffer[], dest: CcDestination): Buffer;
|
|
76
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/currency/wire.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,UAAU,aAAe,CAAC;AACvC,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,QAAQ,qBAAmB,CAAC;AAEzC,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM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AAK,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKxG;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAoBxD;AAED,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAQpC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAwB3F"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ZEROS_32 = exports.INT32_MAX = exports.INT32_MIN = exports.SATOSHIDEN = void 0;
|
|
7
|
+
exports.requireInt32Range = requireInt32Range;
|
|
8
|
+
exports.requireInt64Range = requireInt64Range;
|
|
9
|
+
exports.uint16LE = uint16LE;
|
|
10
|
+
exports.int32LE = int32LE;
|
|
11
|
+
exports.uint32LE = uint32LE;
|
|
12
|
+
exports.int64LE = int64LE;
|
|
13
|
+
exports.varInt = varInt;
|
|
14
|
+
exports.limitedString = limitedString;
|
|
15
|
+
exports.uint160 = uint160;
|
|
16
|
+
exports.uint160Raw = uint160Raw;
|
|
17
|
+
exports.uint256Raw = uint256Raw;
|
|
18
|
+
exports.vectorU160 = vectorU160;
|
|
19
|
+
exports.vectorI64 = vectorI64;
|
|
20
|
+
exports.vectorI32 = vectorI32;
|
|
21
|
+
exports.currencyValueMap = currencyValueMap;
|
|
22
|
+
exports.normalizeWeights = normalizeWeights;
|
|
23
|
+
exports.wrapCcOutput = wrapCcOutput;
|
|
24
|
+
/**
|
|
25
|
+
* Low-level Verus wire encoders shared by the currency-definition serializer and
|
|
26
|
+
* the currency-launch output builders. Kept in one place so the definition output
|
|
27
|
+
* and the notarization/import/export outputs encode integers, vectors, i-addresses
|
|
28
|
+
* and CryptoCondition wrappers identically — the daemon validates them against one
|
|
29
|
+
* another, so any drift between the two would ship an unbroadcastable transaction.
|
|
30
|
+
*
|
|
31
|
+
* Encodings mirror VerusCoin: CompactSize for vector/string lengths, Bitcoin
|
|
32
|
+
* `VARINT` (MSB base-128 continuation) for scalar counts/fees, little-endian
|
|
33
|
+
* fixed-width for the rest. Amounts are bigint satoshis; `number` is only used for
|
|
34
|
+
* genuinely 32-bit fields (protocol ids, heights, ratios).
|
|
35
|
+
*/
|
|
36
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
37
|
+
const boundary_js_1 = require("../fork/boundary.js");
|
|
38
|
+
const index_js_1 = require("../utils/index.js");
|
|
39
|
+
const brands_js_1 = require("../core/brands.js");
|
|
40
|
+
const errors_js_1 = require("../errors.js");
|
|
41
|
+
exports.SATOSHIDEN = 100000000n;
|
|
42
|
+
exports.INT32_MIN = -0x80000000;
|
|
43
|
+
exports.INT32_MAX = 0x7fffffff;
|
|
44
|
+
exports.ZEROS_32 = Buffer.alloc(32);
|
|
45
|
+
/** Assert a bigint fits a non-negative int32 (VARINT-encoded int32 ratio fields). */
|
|
46
|
+
function requireInt32Range(value, label) {
|
|
47
|
+
if (value < 0n || value > BigInt(exports.INT32_MAX)) {
|
|
48
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be in [0, ${exports.INT32_MAX}], got ${value}`);
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
const INT64_MAX = 2n ** 63n - 1n;
|
|
53
|
+
/** Assert a bigint fits a non-negative int64 (VARINT-encoded CAmount fee fields). */
|
|
54
|
+
function requireInt64Range(value, label) {
|
|
55
|
+
if (value < 0n || value > INT64_MAX) {
|
|
56
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be in [0, 2^63-1], got ${value}`);
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
/** Little-endian int16 (uint16 domain — flags/versions are small non-negative). */
|
|
61
|
+
function uint16LE(value, label) {
|
|
62
|
+
if (!Number.isInteger(value) || value < 0 || value > 0xffff) {
|
|
63
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be a uint16, got ${value}`);
|
|
64
|
+
}
|
|
65
|
+
const buf = Buffer.alloc(2);
|
|
66
|
+
buf.writeUInt16LE(value, 0);
|
|
67
|
+
return buf;
|
|
68
|
+
}
|
|
69
|
+
/** Little-endian int32. */
|
|
70
|
+
function int32LE(value, label) {
|
|
71
|
+
if (!Number.isInteger(value) || value < exports.INT32_MIN || value > exports.INT32_MAX) {
|
|
72
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be an int32, got ${value}`);
|
|
73
|
+
}
|
|
74
|
+
const buf = Buffer.alloc(4);
|
|
75
|
+
buf.writeInt32LE(value, 0);
|
|
76
|
+
return buf;
|
|
77
|
+
}
|
|
78
|
+
/** Little-endian uint32. */
|
|
79
|
+
function uint32LE(value, label) {
|
|
80
|
+
if (!Number.isInteger(value) || value < 0 || value > 0xffffffff) {
|
|
81
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be a uint32, got ${value}`);
|
|
82
|
+
}
|
|
83
|
+
const buf = Buffer.alloc(4);
|
|
84
|
+
buf.writeUInt32LE(value, 0);
|
|
85
|
+
return buf;
|
|
86
|
+
}
|
|
87
|
+
/** Little-endian signed int64. */
|
|
88
|
+
function int64LE(value, label) {
|
|
89
|
+
const buf = Buffer.alloc(8);
|
|
90
|
+
try {
|
|
91
|
+
buf.writeBigInt64LE(value, 0);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
throw new errors_js_1.TransactionBuildError(`${label} does not fit in an int64: ${value}`);
|
|
95
|
+
}
|
|
96
|
+
return buf;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Bitcoin/Verus `VARINT` (serialize.h `WriteVarInt`): base-128, MSB continuation,
|
|
100
|
+
* most-significant group first. Distinct from the CompactSize used for vector
|
|
101
|
+
* lengths. Non-negative only (all VARINT fields here are counts/fees/heights).
|
|
102
|
+
*/
|
|
103
|
+
function varInt(value, label) {
|
|
104
|
+
if (value < 0n) {
|
|
105
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be non-negative for VARINT, got ${value}`);
|
|
106
|
+
}
|
|
107
|
+
let n = value;
|
|
108
|
+
const out = [];
|
|
109
|
+
let len = 0;
|
|
110
|
+
for (;;) {
|
|
111
|
+
out.push(Number(n & 0x7fn) | (len > 0 ? 0x80 : 0x00));
|
|
112
|
+
if (n <= 0x7fn)
|
|
113
|
+
break;
|
|
114
|
+
n = (n >> 7n) - 1n;
|
|
115
|
+
len++;
|
|
116
|
+
}
|
|
117
|
+
return Buffer.from(out.reverse());
|
|
118
|
+
}
|
|
119
|
+
/** LIMITED_STRING: CompactSize length + UTF-8 bytes. */
|
|
120
|
+
function limitedString(value, maxLen, label) {
|
|
121
|
+
const bytes = Buffer.from(value, 'utf8');
|
|
122
|
+
if (bytes.length > maxLen) {
|
|
123
|
+
throw new errors_js_1.TransactionBuildError(`${label} exceeds ${maxLen} bytes`);
|
|
124
|
+
}
|
|
125
|
+
return Buffer.concat([(0, index_js_1.writeCompactSize)(bytes.length), bytes]);
|
|
126
|
+
}
|
|
127
|
+
/** A uint160 i-address on the wire: its raw 20-byte hash, no length prefix. */
|
|
128
|
+
function uint160(iAddress, label) {
|
|
129
|
+
const hash = (0, index_js_1.iAddressToHash)((0, brands_js_1.parseIAddress)(iAddress, label));
|
|
130
|
+
if (hash.length !== 20) {
|
|
131
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be a 20-byte i-address hash`);
|
|
132
|
+
}
|
|
133
|
+
return hash;
|
|
134
|
+
}
|
|
135
|
+
/** A pre-hashed uint160 (20 raw bytes), validated for length. */
|
|
136
|
+
function uint160Raw(hash, label) {
|
|
137
|
+
if (hash.length !== 20) {
|
|
138
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be a 20-byte hash, got ${hash.length}`);
|
|
139
|
+
}
|
|
140
|
+
return Buffer.from(hash);
|
|
141
|
+
}
|
|
142
|
+
/** A uint256 (32 raw bytes), validated for length. */
|
|
143
|
+
function uint256Raw(hash, label) {
|
|
144
|
+
if (hash.length !== 32) {
|
|
145
|
+
throw new errors_js_1.TransactionBuildError(`${label} must be a 32-byte hash, got ${hash.length}`);
|
|
146
|
+
}
|
|
147
|
+
return Buffer.from(hash);
|
|
148
|
+
}
|
|
149
|
+
/** CompactSize-counted vector of uint160 i-addresses. */
|
|
150
|
+
function vectorU160(addresses, label) {
|
|
151
|
+
return Buffer.concat([
|
|
152
|
+
(0, index_js_1.writeCompactSize)(addresses.length),
|
|
153
|
+
...addresses.map((a, i) => uint160(a, `${label}[${i}]`)),
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
/** CompactSize-counted vector of little-endian int64 amounts. */
|
|
157
|
+
function vectorI64(values, label) {
|
|
158
|
+
return Buffer.concat([
|
|
159
|
+
(0, index_js_1.writeCompactSize)(values.length),
|
|
160
|
+
...values.map((v, i) => int64LE(v, `${label}[${i}]`)),
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* CompactSize-counted vector of little-endian int32 values (weights). Weights are
|
|
165
|
+
* int32 on the wire, so `Number(v)` is exact here — any bigint that would lose
|
|
166
|
+
* precision (> 2^53) is far above INT32_MAX and rejected by `int32LE` first.
|
|
167
|
+
*/
|
|
168
|
+
function vectorI32(values, label) {
|
|
169
|
+
return Buffer.concat([
|
|
170
|
+
(0, index_js_1.writeCompactSize)(values.length),
|
|
171
|
+
...values.map((v, i) => int32LE(Number(v), `${label}[${i}]`)),
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* `CCurrencyValueMap` wire format: CompactSize(n) + n·(uint160 + int64). Entries
|
|
176
|
+
* must already be sorted by currency id the way the daemon emits them; callers
|
|
177
|
+
* here pass single-entry or empty maps, so ordering is not a concern yet.
|
|
178
|
+
*/
|
|
179
|
+
function currencyValueMap(entries, label) {
|
|
180
|
+
return Buffer.concat([
|
|
181
|
+
(0, index_js_1.writeCompactSize)(entries.length),
|
|
182
|
+
...entries.flatMap((e, i) => [uint160Raw(e.hash, `${label}[${i}].id`), int64LE(e.amount, `${label}[${i}].amount`)]),
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Normalize raw relative reserve weights to canonical weights summing to
|
|
187
|
+
* exactly SATOSHIDEN (1e8), reproducing `definecurrency` byte-for-byte
|
|
188
|
+
* (`CCurrencyDefinition(UniValue)`, VerusCoin `src/pbaas/crosschainrpc.cpp`):
|
|
189
|
+
* each weight becomes `floor(1e8 · raw[i] / Σraw)`, and the last currency — or
|
|
190
|
+
* any earlier one whose share would overrun what remains — absorbs the leftover
|
|
191
|
+
* so the vector sums to precisely 1e8. Byte-locked against the daemon for even
|
|
192
|
+
* and uneven splits (see test/currency-definition.test.ts).
|
|
193
|
+
*/
|
|
194
|
+
function normalizeWeights(raw) {
|
|
195
|
+
let total = 0n;
|
|
196
|
+
for (const w of raw) {
|
|
197
|
+
if (w <= 0n) {
|
|
198
|
+
throw new errors_js_1.TransactionBuildError(`each reserve weight must be > 0, got ${w}`);
|
|
199
|
+
}
|
|
200
|
+
requireInt32Range(w, 'weight'); // the daemon reads each raw weight as an int32
|
|
201
|
+
total += w;
|
|
202
|
+
}
|
|
203
|
+
const out = [];
|
|
204
|
+
let reserveLeft = exports.SATOSHIDEN;
|
|
205
|
+
raw.forEach((w, i) => {
|
|
206
|
+
let amount = (exports.SATOSHIDEN * w) / total; // integer floor, matching arith_uint256
|
|
207
|
+
if (reserveLeft <= amount || i + 1 === raw.length) {
|
|
208
|
+
amount = reserveLeft;
|
|
209
|
+
}
|
|
210
|
+
reserveLeft -= amount;
|
|
211
|
+
out.push(amount);
|
|
212
|
+
});
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
215
|
+
function toTxDestination(dest) {
|
|
216
|
+
return dest.kind === 'pubkey'
|
|
217
|
+
? new boundary_js_1.TxDestination(new boundary_js_1.PubKey(dest.pubkey, true))
|
|
218
|
+
: new boundary_js_1.TxDestination(new boundary_js_1.KeyID(uint160Raw(dest.hash, 'cc destination hash')));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Wrap serialized data in a Verus CryptoCondition output script:
|
|
222
|
+
* `OptCCParams(master, eval 0) OP_CHECKCRYPTOCONDITION OptCCParams(params, evalCode) OP_DROP`,
|
|
223
|
+
* both m=1/n=1 to a single fixed destination. This is the shape every CC output
|
|
224
|
+
* in a currency-definition transaction uses; the eval code, destination, and
|
|
225
|
+
* payload vary per output.
|
|
226
|
+
*/
|
|
227
|
+
function wrapCcOutput(evalCode, vdata, dest) {
|
|
228
|
+
const destination = () => toTxDestination(dest);
|
|
229
|
+
const master = new boundary_js_1.OptCCParams({
|
|
230
|
+
version: new bn_js_1.default(3),
|
|
231
|
+
eval_code: new bn_js_1.default(0),
|
|
232
|
+
m: new bn_js_1.default(1),
|
|
233
|
+
n: new bn_js_1.default(1),
|
|
234
|
+
destinations: [destination()],
|
|
235
|
+
vdata: [],
|
|
236
|
+
});
|
|
237
|
+
const params = new boundary_js_1.OptCCParams({
|
|
238
|
+
version: new bn_js_1.default(3),
|
|
239
|
+
eval_code: new bn_js_1.default(evalCode),
|
|
240
|
+
m: new bn_js_1.default(1),
|
|
241
|
+
n: new bn_js_1.default(1),
|
|
242
|
+
destinations: [destination()],
|
|
243
|
+
vdata,
|
|
244
|
+
});
|
|
245
|
+
return boundary_js_1.script.compile([
|
|
246
|
+
master.toChunk(),
|
|
247
|
+
boundary_js_1.opcodes.OP_CHECKCRYPTOCONDITION,
|
|
248
|
+
params.toChunk(),
|
|
249
|
+
boundary_js_1.opcodes.OP_DROP,
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/currency/wire.ts"],"names":[],"mappings":";;;;;;AA+BA,8CAKC;AAKD,8CAKC;AAGD,4BAOC;AAGD,0BAOC;AAGD,4BAOC;AAGD,0BAQC;AAOD,wBAcC;AAGD,sCAMC;AAGD,0BAMC;AAGD,gCAKC;AAGD,gCAKC;AAGD,gCAKC;AAGD,8BAKC;AAOD,8BAKC;AAOD,4CAKC;AAWD,4CAoBC;AAoBD,oCAwBC;AAjQD;;;;;;;;;;;GAWG;AACH,kDAAuB;AACvB,qDAO6B;AAC7B,gDAAqE;AACrE,iDAAkD;AAClD,4CAAqD;AAExC,QAAA,UAAU,GAAG,UAAY,CAAC;AAC1B,QAAA,SAAS,GAAG,CAAC,UAAU,CAAC;AACxB,QAAA,SAAS,GAAG,UAAU,CAAC;AACvB,QAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAEzC,qFAAqF;AACrF,SAAgB,iBAAiB,CAAC,KAAa,EAAE,KAAa;IAC5D,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,MAAM,CAAC,iBAAS,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,iCAAqB,CAAC,GAAG,KAAK,mBAAmB,iBAAS,UAAU,KAAK,EA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B,MAAM,CAAC,OAAO,EAAE;QAChB,qBAAO,CAAC,uBAAuB;QAC/B,MAAM,CAAC,OAAO,EAAE;QAChB,qBAAO,CAAC,OAAO;KAChB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export { VerusSDK } from './VerusSDK.js';
|
|
|
8
8
|
export type { Utxo, DecodedUtxo, SelectionResult, VerusSDKConfig, SignedTxResult, TransferParams, TransferTokenParams, ConvertParams, CurrencyOutput, SendCurrencyParams, SendCurrencyResult, BuildAndSignParams, CommitmentData, CreateCommitmentParams, CreateCommitmentResult, RegisterIdentityParams, RegisterIdentityResult, UpdateIdentityParams, UpdateIdentityResult, LockIdentityParams, UnlockIdentityParams, RevokeIdentityParams, RecoverIdentityParams, DefineCurrencyParams, DefineCurrencyResult, SignMessageParams, SignMessageResult, VerifyMessageParams, VerifyMessageResult, } from './types/index.js';
|
|
9
9
|
export { classifyCurrency, CURRENCY_TYPE_ORDER } from './currency/classify.js';
|
|
10
10
|
export type { CurrencyType } from './currency/classify.js';
|
|
11
|
+
export { serializeCurrencyDefinition, buildCurrencyDefinitionScript, CURRENCY_OPTION, NOTARIZATION_PROTOCOL, PROOF_PROTOCOL, } from './currency/definition.js';
|
|
12
|
+
export type { CurrencyDefinitionInput } from './currency/definition.js';
|
|
13
|
+
export { buildCurrencyLaunchOutputs } from './currency/outputs.js';
|
|
14
|
+
export type { CurrencyLaunchContext, CurrencyLaunchOutputs, CurrencyLaunchOutput } from './currency/outputs.js';
|
|
15
|
+
export { buildCurrencyLaunchTransaction } from './currency/launch.js';
|
|
16
|
+
export type { CurrencyLaunchTxParams, CurrencyLaunchTxResult } from './currency/launch.js';
|
|
17
|
+
export { buildReserveTransferOutput } from './currency/reserveTransfer.js';
|
|
18
|
+
export type { ReserveTransferParams, ReserveTransferBuildResult } from './currency/reserveTransfer.js';
|
|
11
19
|
export { BASE58_RE, isRAddress, isIAddress, isVerusAddress, isIdentityName, } from './address/index.js';
|
|
12
20
|
export { parseSats, toSatoshis, toCoins, toSafeNumber, SATS_PER_COIN, AMOUNT_DECIMALS, } from './utils/index.js';
|
|
13
21
|
export { VerusError, InsufficientFundsError, InvalidWifError, InvalidAddressError, InvalidNameError, TransactionBuildError, InvalidAmountError, } from './errors.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,YAAY,EACV,IAAI,EACJ,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GACnB,MAA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AQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,EAC5B,gBAAgB,EAChB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
};
|
|
39
39
|
})();
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.
|
|
41
|
+
exports.utxo = exports.signing = exports.keys = exports.address = exports.HASH_SHA256 = exports.IDENTITY_FLAG_LOCKED = exports.IDENTITY_FLAG_ACTIVECURRENCY = exports.I_ADDR_VERSION = exports.WIF_PREFIX = exports.SCRIPT_HASH_PREFIX = exports.PUBKEY_HASH_PREFIX = exports.RESERVE_TRANSFER_FEE = exports.DEFAULT_EXPIRY_DELTA = exports.DEFAULT_REFERRAL_LEVELS = exports.DEFAULT_REGISTRATION_FEE = exports.DUST_THRESHOLD = exports.DEFAULT_FEE_PER_KB = exports.TX_VERSION = exports.CONSENSUS_BRANCH_ID = exports.VERSION_GROUP_ID = exports.NETWORK_CONFIG = exports.InvalidAmountError = exports.TransactionBuildError = exports.InvalidNameError = exports.InvalidAddressError = exports.InvalidWifError = exports.InsufficientFundsError = exports.VerusError = exports.AMOUNT_DECIMALS = exports.SATS_PER_COIN = exports.toSafeNumber = exports.toCoins = exports.toSatoshis = exports.parseSats = exports.isIdentityName = exports.isVerusAddress = exports.isIAddress = exports.isRAddress = exports.BASE58_RE = exports.buildReserveTransferOutput = exports.buildCurrencyLaunchTransaction = exports.buildCurrencyLaunchOutputs = exports.PROOF_PROTOCOL = exports.NOTARIZATION_PROTOCOL = exports.CURRENCY_OPTION = exports.buildCurrencyDefinitionScript = exports.serializeCurrencyDefinition = exports.CURRENCY_TYPE_ORDER = exports.classifyCurrency = exports.VerusSDK = void 0;
|
|
42
|
+
exports.identityMultisig = exports.offers = exports.utils = exports.currency = exports.message = exports.transfer = exports.identity = void 0;
|
|
42
43
|
// Main facade
|
|
43
44
|
var VerusSDK_js_1 = require("./VerusSDK.js");
|
|
44
45
|
Object.defineProperty(exports, "VerusSDK", { enumerable: true, get: function () { return VerusSDK_js_1.VerusSDK; } });
|
|
@@ -46,6 +47,20 @@ Object.defineProperty(exports, "VerusSDK", { enumerable: true, get: function ()
|
|
|
46
47
|
var classify_js_1 = require("./currency/classify.js");
|
|
47
48
|
Object.defineProperty(exports, "classifyCurrency", { enumerable: true, get: function () { return classify_js_1.classifyCurrency; } });
|
|
48
49
|
Object.defineProperty(exports, "CURRENCY_TYPE_ORDER", { enumerable: true, get: function () { return classify_js_1.CURRENCY_TYPE_ORDER; } });
|
|
50
|
+
// Structured currency-definition builder (also available via currency namespace)
|
|
51
|
+
var definition_js_1 = require("./currency/definition.js");
|
|
52
|
+
Object.defineProperty(exports, "serializeCurrencyDefinition", { enumerable: true, get: function () { return definition_js_1.serializeCurrencyDefinition; } });
|
|
53
|
+
Object.defineProperty(exports, "buildCurrencyDefinitionScript", { enumerable: true, get: function () { return definition_js_1.buildCurrencyDefinitionScript; } });
|
|
54
|
+
Object.defineProperty(exports, "CURRENCY_OPTION", { enumerable: true, get: function () { return definition_js_1.CURRENCY_OPTION; } });
|
|
55
|
+
Object.defineProperty(exports, "NOTARIZATION_PROTOCOL", { enumerable: true, get: function () { return definition_js_1.NOTARIZATION_PROTOCOL; } });
|
|
56
|
+
Object.defineProperty(exports, "PROOF_PROTOCOL", { enumerable: true, get: function () { return definition_js_1.PROOF_PROTOCOL; } });
|
|
57
|
+
// Full offline currency-launch output builder (all 7 outputs, byte-equivalent to definecurrency)
|
|
58
|
+
var outputs_js_1 = require("./currency/outputs.js");
|
|
59
|
+
Object.defineProperty(exports, "buildCurrencyLaunchOutputs", { enumerable: true, get: function () { return outputs_js_1.buildCurrencyLaunchOutputs; } });
|
|
60
|
+
var launch_js_1 = require("./currency/launch.js");
|
|
61
|
+
Object.defineProperty(exports, "buildCurrencyLaunchTransaction", { enumerable: true, get: function () { return launch_js_1.buildCurrencyLaunchTransaction; } });
|
|
62
|
+
var reserveTransfer_js_1 = require("./currency/reserveTransfer.js");
|
|
63
|
+
Object.defineProperty(exports, "buildReserveTransferOutput", { enumerable: true, get: function () { return reserveTransfer_js_1.buildReserveTransferOutput; } });
|
|
49
64
|
// Address utilities (also available via address namespace)
|
|
50
65
|
var index_js_1 = require("./address/index.js");
|
|
51
66
|
Object.defineProperty(exports, "BASE58_RE", { enumerable: true, get: function () { return index_js_1.BASE58_RE; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,cAAc;AACd,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AAmCjB,kEAAkE;AAClE,sDAA+E;AAAtE,+GAAA,gBAAgB,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAG9C,iFAAiF;AACjF,0DAMkC;AALhC,4HAAA,2BAA2B,OAAA;AAC3B,8HAAA,6BAA6B,OAAA;AAC7B,gHAAA,eAAe,OAAA;AACf,sHAAA,qBAAqB,OAAA;AACrB,+GAAA,cAAc,OAAA;AAIhB,iGAAiG;AACjG,oDAAmE;AAA1D,wHAAA,0BAA0B,OAAA;AAEnC,kDAAsE;AAA7D,2HAAA,8BAA8B,OAAA;A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AA0C;AAC1C,sFAAsF;AACtF,6DAA6C;AAC7C,4EAA4E;AAC5E,2EAA2D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOrD,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAkG3B;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,OAAO,GACf,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOrD,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAkG3B;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,OAAO,GACf,kBAAkB,CAqIpB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,OAAO,GACf,kBAAkB,CAepB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,OAAO,GACf,kBAAkB,CAcpB;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,GACf,kBAAkB,CAgBpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,OAAO,GACf,cAAc,CAwEhB"}
|