@chainvue/verus-sdk 0.4.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -0
  3. package/dist/VerusSDK.d.ts +59 -0
  4. package/dist/VerusSDK.d.ts.map +1 -0
  5. package/dist/VerusSDK.js +170 -0
  6. package/dist/VerusSDK.js.map +1 -0
  7. package/dist/address/index.d.ts +16 -0
  8. package/dist/address/index.d.ts.map +1 -0
  9. package/dist/address/index.js +33 -0
  10. package/dist/address/index.js.map +1 -0
  11. package/dist/bundle.js +34129 -0
  12. package/dist/constants/index.d.ts +51 -0
  13. package/dist/constants/index.d.ts.map +1 -0
  14. package/dist/constants/index.js +53 -0
  15. package/dist/constants/index.js.map +1 -0
  16. package/dist/currency/classify.d.ts +14 -0
  17. package/dist/currency/classify.d.ts.map +1 -0
  18. package/dist/currency/classify.js +32 -0
  19. package/dist/currency/classify.js.map +1 -0
  20. package/dist/currency/index.d.ts +22 -0
  21. package/dist/currency/index.d.ts.map +1 -0
  22. package/dist/currency/index.js +87 -0
  23. package/dist/currency/index.js.map +1 -0
  24. package/dist/errors.d.ts +37 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/errors.js +69 -0
  27. package/dist/errors.js.map +1 -0
  28. package/dist/identity/index.d.ts +129 -0
  29. package/dist/identity/index.d.ts.map +1 -0
  30. package/dist/identity/index.js +691 -0
  31. package/dist/identity/index.js.map +1 -0
  32. package/dist/index.d.ts +24 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +96 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/keys/index.d.ts +48 -0
  37. package/dist/keys/index.d.ts.map +1 -0
  38. package/dist/keys/index.js +169 -0
  39. package/dist/keys/index.js.map +1 -0
  40. package/dist/message/index.d.ts +18 -0
  41. package/dist/message/index.d.ts.map +1 -0
  42. package/dist/message/index.js +61 -0
  43. package/dist/message/index.js.map +1 -0
  44. package/dist/signing/index.d.ts +53 -0
  45. package/dist/signing/index.d.ts.map +1 -0
  46. package/dist/signing/index.js +100 -0
  47. package/dist/signing/index.js.map +1 -0
  48. package/dist/transfer/index.d.ts +37 -0
  49. package/dist/transfer/index.d.ts.map +1 -0
  50. package/dist/transfer/index.js +275 -0
  51. package/dist/transfer/index.js.map +1 -0
  52. package/dist/types/index.d.ts +359 -0
  53. package/dist/types/index.d.ts.map +1 -0
  54. package/dist/types/index.js +6 -0
  55. package/dist/types/index.js.map +1 -0
  56. package/dist/utils/index.d.ts +48 -0
  57. package/dist/utils/index.d.ts.map +1 -0
  58. package/dist/utils/index.js +141 -0
  59. package/dist/utils/index.js.map +1 -0
  60. package/dist/utxo/index.d.ts +21 -0
  61. package/dist/utxo/index.d.ts.map +1 -0
  62. package/dist/utxo/index.js +139 -0
  63. package/dist/utxo/index.js.map +1 -0
  64. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robert Lech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @chainvue/verus-sdk
2
+
3
+ **100% offline Verus transaction signing.** Build and sign Verus
4
+ transactions — native transfers, token/currency transfers, conversions,
5
+ and the full VerusID lifecycle (name commitment, registration, sub-IDs,
6
+ update/revoke/recover, message signing) — with no daemon and no network
7
+ access. You bring UTXOs and a WIF; the SDK returns signed transaction hex.
8
+
9
+ Serialization delegates to VerusCoin's own primitives
10
+ (`verus-typescript-primitives`) and a fork of `@bitgo/utxo-lib`, so the
11
+ wire format is the daemon's, not a reimplementation.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @chainvue/verus-sdk
17
+ ```
18
+
19
+ The published package is a **self-contained bundle**: the VerusCoin forks
20
+ (utxo-lib, primitives, bitcoin-ops) are inlined, so there are no `github:`
21
+ dependencies or install-time patches in your dependency graph. Regular npm
22
+ dependencies (`tiny-secp256k1`, `ecpair`, `bs58check`, `bn.js`,
23
+ `create-hash`, `wif`) install normally.
24
+
25
+ > **TypeScript consumers:** the type declarations reference the fork
26
+ > packages' types, so set `"skipLibCheck": true` in your `tsconfig.json`
27
+ > until the declarations are rolled up. Runtime is unaffected.
28
+
29
+ ## Usage
30
+
31
+ ```ts
32
+ import { VerusSDK } from '@chainvue/verus-sdk';
33
+
34
+ const sdk = new VerusSDK({ network: 'testnet' }); // or 'mainnet'
35
+
36
+ // Native transfer — returns { signedTx, txid, fee, inputsUsed, nativeChange }
37
+ const result = sdk.transfer({
38
+ wif: '<WIF>',
39
+ to: 'R...recipient',
40
+ amount: 100_000_000, // satoshis
41
+ utxos: [/* { txid, outputIndex, satoshis, script } */],
42
+ changeAddress: 'R...change',
43
+ });
44
+ // broadcast result.signedTx via your own RPC (e.g. verus-rpc sendrawtransaction)
45
+
46
+ // Decode a signed tx for a wallet ledger:
47
+ import { utils } from '@chainvue/verus-sdk';
48
+ const summary = utils.summarizeSignedTransaction(result.signedTx, 'testnet');
49
+ // { txid, inputs: [{txid, vout}], outputs: [{valueSat, scriptHex, address}] }
50
+ ```
51
+
52
+ Static helpers: `VerusSDK.generateWif()`, `VerusSDK.deriveAddress(wif)`,
53
+ `VerusSDK.deriveIdentityAddress(name, parent?)`,
54
+ `VerusSDK.validateAddress(addr)`, `VerusSDK.validateWif(wif)`.
55
+
56
+ Identity lifecycle: `createCommitment`, `registerIdentity`,
57
+ `updateIdentity` / `lockIdentity` / `unlockIdentity` / `revokeIdentity` /
58
+ `recoverIdentity`, plus `signMessage` / `verifyMessage`.
59
+
60
+ ## Safety
61
+
62
+ - **Every built transfer is validated** against its unfunded intent
63
+ (utxo-lib's own funded-transfer validator: per-currency value
64
+ conservation, change to the declared address) before the hex is returned
65
+ — a selection/change bug throws instead of producing a bad tx.
66
+ - Signing is **offline**: the SDK never opens a socket. Broadcasting,
67
+ UTXO fetching and confirmation tracking are the caller's job.
68
+
69
+ ## Status
70
+
71
+ Pre-release. The transaction wire format is proven against a live VRSCTEST
72
+ daemon (decode round-trip + `sendrawtransaction` acceptance) — see
73
+ [RISKS.md](./RISKS.md) for the live-proof harness and open items.
74
+
75
+ License: Apache-2.0.
@@ -0,0 +1,59 @@
1
+ /**
2
+ * VerusSDK — Facade class for all offline Verus transaction signing operations
3
+ *
4
+ * Holds network configuration; all methods delegate to core modules.
5
+ * Power users can import core modules directly for more control.
6
+ */
7
+ import type { Network } from './constants/index.js';
8
+ import type { VerusSDKConfig, TransferParams, TransferTokenParams, ConvertParams, SendCurrencyParams, SendCurrencyResult, BuildAndSignParams, SignedTxResult, CreateCommitmentParams, CreateCommitmentResult, RegisterIdentityParams, RegisterIdentityResult, UpdateIdentityParams, UpdateIdentityResult, LockIdentityParams, UnlockIdentityParams, RevokeIdentityParams, RecoverIdentityParams, DefineCurrencyParams, DefineCurrencyResult, SignMessageParams, SignMessageResult, VerifyMessageParams, VerifyMessageResult } from './types/index.js';
9
+ export declare class VerusSDK {
10
+ readonly network: Network;
11
+ constructor(config: VerusSDKConfig);
12
+ /** Simple native VRSC transfer to an R-address */
13
+ transfer(params: TransferParams): SendCurrencyResult;
14
+ /** Token/currency transfer */
15
+ transferToken(params: TransferTokenParams): SendCurrencyResult;
16
+ /** Currency conversion */
17
+ convert(params: ConvertParams): SendCurrencyResult;
18
+ /** Full-control currency transfer (supports all output types) */
19
+ sendCurrency(params: SendCurrencyParams): SendCurrencyResult;
20
+ /** Build and sign a simple P2PKH transaction */
21
+ buildAndSign(params: BuildAndSignParams): SignedTxResult;
22
+ /** Step 1 of identity creation: create a name commitment */
23
+ createCommitment(params: CreateCommitmentParams): CreateCommitmentResult;
24
+ /** Step 2 of identity creation: register the identity */
25
+ registerIdentity(params: RegisterIdentityParams): RegisterIdentityResult;
26
+ /** Update an existing identity (change primary addresses, authorities, content) */
27
+ updateIdentity(params: UpdateIdentityParams): UpdateIdentityResult;
28
+ /** Lock an identity until a specified block height */
29
+ lockIdentity(params: LockIdentityParams): UpdateIdentityResult;
30
+ /** Initiate identity unlock */
31
+ unlockIdentity(params: UnlockIdentityParams): UpdateIdentityResult;
32
+ /** Revoke an identity (requires revocation authority key) */
33
+ revokeIdentity(params: RevokeIdentityParams): UpdateIdentityResult;
34
+ /** Recover an identity (requires recovery authority key) */
35
+ recoverIdentity(params: RecoverIdentityParams): UpdateIdentityResult;
36
+ /** Define a new currency (manual mode — pre-built script) */
37
+ defineCurrency(params: DefineCurrencyParams): DefineCurrencyResult;
38
+ /** Sign a message with a VerusID identity signature */
39
+ signMessage(params: SignMessageParams): SignMessageResult;
40
+ /** Verify a VerusID message signature */
41
+ verifyMessage(params: VerifyMessageParams): VerifyMessageResult;
42
+ /** Derive R-address from WIF private key */
43
+ static deriveAddress(wif: string): Promise<string>;
44
+ /** Derive identity i-address from a name and optional parent */
45
+ static deriveIdentityAddress(name: string, parentIAddress?: string): string;
46
+ /** Generate a new random WIF private key */
47
+ static generateWif(): string;
48
+ /** Validate a Verus R-address */
49
+ static validateAddress(address: string): {
50
+ valid: boolean;
51
+ error?: string;
52
+ };
53
+ /** Validate a WIF private key */
54
+ static validateWif(wif: string): {
55
+ valid: boolean;
56
+ error?: string;
57
+ };
58
+ }
59
+ //# sourceMappingURL=VerusSDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerusSDK.d.ts","sourceRoot":"","sources":["../src/VerusSDK.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,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,EACpB,MAAM,kBAAkB,CAAC;AAQ1B,qBAAa,QAAQ;IACnB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;gBAEd,MAAM,EAAE,cAAc;IAMlC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB;IAIpD,8BAA8B;IAC9B,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,kBAAkB;IAI9D,0BAA0B;IAC1B,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,kBAAkB;IAIlD,iEAAiE;IACjE,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB;IAI5D,gDAAgD;IAChD,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc;IAMxD,4DAA4D;IAC5D,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB;IA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ing operations
4
+ *
5
+ * Holds network configuration; all methods delegate to core modules.
6
+ * Power users can import core modules directly for more control.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.VerusSDK = void 0;
43
+ const transferModule = __importStar(require("./transfer/index.js"));
44
+ const identityModule = __importStar(require("./identity/index.js"));
45
+ const messageModule = __importStar(require("./message/index.js"));
46
+ const currencyModule = __importStar(require("./currency/index.js"));
47
+ const keysModule = __importStar(require("./keys/index.js"));
48
+ class VerusSDK {
49
+ constructor(config) {
50
+ this.network = config.network;
51
+ }
52
+ // ─── Transfers ─────────────────────────────────────
53
+ /** Simple native VRSC transfer to an R-address */
54
+ transfer(params) {
55
+ return transferModule.transfer(params, this.network);
56
+ }
57
+ /** Token/currency transfer */
58
+ transferToken(params) {
59
+ return transferModule.transferToken(params, this.network);
60
+ }
61
+ /** Currency conversion */
62
+ convert(params) {
63
+ return transferModule.convert(params, this.network);
64
+ }
65
+ /** Full-control currency transfer (supports all output types) */
66
+ sendCurrency(params) {
67
+ return transferModule.sendCurrency(params, this.network);
68
+ }
69
+ /** Build and sign a simple P2PKH transaction */
70
+ buildAndSign(params) {
71
+ return transferModule.buildAndSign(params, this.network);
72
+ }
73
+ // ─── Identity ──────────────────────────────────────
74
+ /** Step 1 of identity creation: create a name commitment */
75
+ createCommitment(params) {
76
+ return identityModule.buildAndSignCommitment(params, this.network);
77
+ }
78
+ /** Step 2 of identity creation: register the identity */
79
+ registerIdentity(params) {
80
+ return identityModule.buildAndSignRegistration(params, this.network);
81
+ }
82
+ /** Update an existing identity (change primary addresses, authorities, content) */
83
+ updateIdentity(params) {
84
+ return identityModule.buildAndSignIdentityUpdate(params, this.network, 'update');
85
+ }
86
+ /** Lock an identity until a specified block height */
87
+ lockIdentity(params) {
88
+ return identityModule.buildAndSignIdentityUpdate({
89
+ wif: params.wif,
90
+ identityHex: params.identityHex,
91
+ identityUtxo: params.identityUtxo,
92
+ utxos: params.utxos,
93
+ changeAddress: params.changeAddress,
94
+ expiryHeight: params.expiryHeight,
95
+ }, this.network, 'lock', { unlockAfter: params.unlockAfter });
96
+ }
97
+ /** Initiate identity unlock */
98
+ unlockIdentity(params) {
99
+ return identityModule.buildAndSignIdentityUpdate({
100
+ wif: params.wif,
101
+ identityHex: params.identityHex,
102
+ identityUtxo: params.identityUtxo,
103
+ utxos: params.utxos,
104
+ changeAddress: params.changeAddress,
105
+ expiryHeight: params.expiryHeight,
106
+ }, this.network, 'unlock');
107
+ }
108
+ /** Revoke an identity (requires revocation authority key) */
109
+ revokeIdentity(params) {
110
+ return identityModule.buildAndSignIdentityUpdate({
111
+ wif: params.wif,
112
+ identityHex: params.identityHex,
113
+ identityUtxo: params.identityUtxo,
114
+ utxos: params.utxos,
115
+ changeAddress: params.changeAddress,
116
+ expiryHeight: params.expiryHeight,
117
+ }, this.network, 'revoke');
118
+ }
119
+ /** Recover an identity (requires recovery authority key) */
120
+ recoverIdentity(params) {
121
+ return identityModule.buildAndSignIdentityUpdate({
122
+ wif: params.wif,
123
+ identityHex: params.identityHex,
124
+ identityUtxo: params.identityUtxo,
125
+ utxos: params.utxos,
126
+ changeAddress: params.changeAddress,
127
+ primaryAddresses: params.primaryAddresses,
128
+ revocationAuthority: params.revocationAuthority,
129
+ recoveryAuthority: params.recoveryAuthority,
130
+ expiryHeight: params.expiryHeight,
131
+ }, this.network, 'recover');
132
+ }
133
+ // ─── Currency ──────────────────────────────────────
134
+ /** Define a new currency (manual mode — pre-built script) */
135
+ defineCurrency(params) {
136
+ return currencyModule.defineCurrency(params, this.network);
137
+ }
138
+ // ─── Message Signing ───────────────────────────────
139
+ /** Sign a message with a VerusID identity signature */
140
+ signMessage(params) {
141
+ return messageModule.signMessage(params, this.network);
142
+ }
143
+ /** Verify a VerusID message signature */
144
+ verifyMessage(params) {
145
+ return messageModule.verifyMessage(params, this.network);
146
+ }
147
+ // ─── Static Utilities ─────────────────────────────
148
+ /** Derive R-address from WIF private key */
149
+ static async deriveAddress(wif) {
150
+ return keysModule.wifToAddress(wif);
151
+ }
152
+ /** Derive identity i-address from a name and optional parent */
153
+ static deriveIdentityAddress(name, parentIAddress) {
154
+ return identityModule.deriveIdentityAddress(name, parentIAddress);
155
+ }
156
+ /** Generate a new random WIF private key */
157
+ static generateWif() {
158
+ return keysModule.generateWif();
159
+ }
160
+ /** Validate a Verus R-address */
161
+ static validateAddress(address) {
162
+ return keysModule.validateAddress(address);
163
+ }
164
+ /** Validate a WIF private key */
165
+ static validateWif(wif) {
166
+ return keysModule.validateWif(wif);
167
+ }
168
+ }
169
+ exports.VerusSDK = VerusSDK;
170
+ //# sourceMappingURL=VerusSDK.js.map
@@ -0,0 +1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IAAI,EAAE,cAAc,CAAC,CAAC;IACpE,CAAC;IAED,4CAA4C;IAC5C,MAAM,CAAC,WAAW;QAChB,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,iCAAiC;IACjC,MAAM,CAAC,eAAe,CAAC,OAAe;QACpC,OAAO,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,iCAAiC;IACjC,MAAM,CAAC,WAAW,CAAC,GAAW;QAC5B,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;CACF;AApKD,4BAoKC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Address format detection utilities
3
+ *
4
+ * Simple format checks for input routing (send forms, address fields).
5
+ * For full base58check validation, use keys.validateAddress().
6
+ */
7
+ export declare const BASE58_RE: RegExp;
8
+ /** Check if input looks like a Verus R-address */
9
+ export declare function isRAddress(input: string): boolean;
10
+ /** Check if input looks like a Verus i-address */
11
+ export declare function isIAddress(input: string): boolean;
12
+ /** Check if input looks like any Verus address (R or i) */
13
+ export declare function isVerusAddress(input: string): boolean;
14
+ /** Check if input looks like an identity name (not an address) */
15
+ export declare function isIdentityName(input: string): boolean;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/address/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,SAAS,QAA4B,CAAC;AAEnD,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGrD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * Address format detection utilities
4
+ *
5
+ * Simple format checks for input routing (send forms, address fields).
6
+ * For full base58check validation, use keys.validateAddress().
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BASE58_RE = void 0;
10
+ exports.isRAddress = isRAddress;
11
+ exports.isIAddress = isIAddress;
12
+ exports.isVerusAddress = isVerusAddress;
13
+ exports.isIdentityName = isIdentityName;
14
+ exports.BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]+$/;
15
+ /** Check if input looks like a Verus R-address */
16
+ function isRAddress(input) {
17
+ return input.startsWith('R') && input.length >= 26 && input.length <= 36 && exports.BASE58_RE.test(input);
18
+ }
19
+ /** Check if input looks like a Verus i-address */
20
+ function isIAddress(input) {
21
+ return input.startsWith('i') && input.length >= 26 && input.length <= 36 && exports.BASE58_RE.test(input);
22
+ }
23
+ /** Check if input looks like any Verus address (R or i) */
24
+ function isVerusAddress(input) {
25
+ return isRAddress(input) || isIAddress(input);
26
+ }
27
+ /** Check if input looks like an identity name (not an address) */
28
+ function isIdentityName(input) {
29
+ if (!input || isVerusAddress(input))
30
+ return false;
31
+ return input.endsWith('@') || !exports.BASE58_RE.test(input) || input.length < 26;
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/address/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAKH,gCAEC;AAGD,gCAEC;AAGD,wCAEC;AAGD,wCAGC;AArBY,QAAA,SAAS,GAAG,yBAAyB,CAAC;AAEnD,kDAAkD;AAClD,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,iBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpG,CAAC;AAED,kDAAkD;AAClD,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,iBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpG,CAAC;AAED,2DAA2D;AAC3D,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,kEAAkE;AAClE,SAAgB,cAAc,CAAC,KAAa;IAC1C,IAAI,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;AAC5E,CAAC"}