@xrpl-wallet-kit/xahau 0.0.0-stage → 0.2.1

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 CHANGED
@@ -1,3 +1,81 @@
1
- # Temporary Holding Version
1
+ # @xrpl-wallet-kit/xahau
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Xahau protocol runtime, available from v0.2.0. Core/UI/adapters do not import this
4
+ package. Core/selective consumers keep Xahau as an explicit dependency.
5
+ The all-in-one client installs it automatically and registers a lazy runtime
6
+ when Xahau is configured; dApps using that client do not need the imports below.
7
+ The browser IIFE loads a separate, version-matched Xahau runtime only on first
8
+ transaction preparation or lookup. Self-host its runtime asset beside the IIFE;
9
+ see the browser package README for CSP and CDN version pinning requirements.
10
+
11
+ ```ts
12
+ import { WalletManager } from "@xrpl-wallet-kit/core";
13
+ import { createXahauProtocol, XAHAU_NETWORKS } from "@xrpl-wallet-kit/xahau";
14
+ import { createXyraAdapter } from "@xrpl-wallet-kit/adapter-xyra";
15
+
16
+ const manager = new WalletManager({
17
+ network: "xahau-testnet",
18
+ networks: [...XAHAU_NETWORKS],
19
+ protocols: [createXahauProtocol()],
20
+ adapters: [createXyraAdapter({ supportedChains: { families: ["xrpl", "xahau"] } })]
21
+ });
22
+ await manager.connect("xyra"); // explicit user action
23
+ const result = await manager.signTransaction({
24
+ txJson: { TransactionType: "Payment", Destination: "r...", Amount: "1" },
25
+ maxFeeDrops: "100000" // app/user-selected ceiling, not a recommended default
26
+ });
27
+ ```
28
+
29
+ The same opt-in applies to Xaman, GemWallet and Ledger. Register mainnet 21337
30
+ or testnet 21338 explicitly. RPC identity is checked against the selected preset.
31
+ For browser CORS, inject a trusted `request(network, method, params, signal)`
32
+ implementation; never proxy arbitrary provider URLs. The 5173 local console
33
+ already supplies a fixed-endpoint proxy and supports both chains/networks.
34
+
35
+ Implemented transaction scope: native Payment, Invoke/HookParameters, TrustSet,
36
+ OfferCreate, OfferCancel, AccountSet, URITokenMint/Burn/Buy/CreateSellOffer/
37
+ CancelSellOffer; master-key single-sign only. Unsupported
38
+ types, multisign, noncanonical/dropped fields, conflicting Account/NetworkID,
39
+ unbounded fees and expired/stale preparation fail closed. Xahau NFTs use URIToken
40
+ transactions, not the XRPL console's NFToken offer forms. SetHook, XLS-20 parity,
41
+ chain-bound message auth and passive Xahau session restore are not claimed.
42
+
43
+ The local console exposes raw message signing for Xaman (non-submittable SignIn,
44
+ explicit Xahau network selector) and GemWallet (native message signature).
45
+ Signing a message is separate from authentication: these results do not establish
46
+ chain ownership, freshness or replay protection. Applications must include their
47
+ domain/network/nonce in the message and verify the returned proof appropriately.
48
+ The XRPL auth demo remains disabled on Xahau. Xyra and Ledger do not advertise a
49
+ message signing API in their current adapters. Live acceptance is still required.
50
+
51
+ All Xahau adapters sign without broadcast, verify the complete blob/intent/key/
52
+ signature/hash/fee, and recheck preflight. Explicit sign-and-submit then sends
53
+ the verified blob to the configured RPC; accepted broadcasts remain `submitted`,
54
+ not validated success. Never retry an uncertain submission blindly. Ledger app
55
+ support is transaction/field/version dependent. Explicit Ledger connect now
56
+ requests the XAH device app by default (autoOpenApp can be disabled); it never
57
+ enables blind signing or silently falls back to XRP. Live device/wallet
58
+ acceptance is performed by the user.
59
+
60
+ Preparation reads `account_info` from the current open ledger with queue data,
61
+ and selects the next sequence after locally queued transactions. Network identity
62
+ and transaction expiry still use a recent validated ledger. This is not a global
63
+ sequence reservation: serialize concurrent signing from the same account.
64
+
65
+ Submission errors use `SUBMIT_FAILED`, preserving `hash`, `engineResult`,
66
+ `submissionRejected`, `final` and `outcomeUnknown` when available. A local
67
+ `tef`/`tel` rejection is not proof of final failure across the network;
68
+ `tem` is final, while already-seen/past-sequence, relayed and provisional
69
+ responses still need hash lookup. Never infer permission to create a new
70
+ payment from `outcomeUnknown: false` alone.
71
+
72
+ Compatibility checked locally with Node 22.17 (native ESM), Vite 6.4.3
73
+ (production Chrome execution) and Next 16.3.8 (production server prerender).
74
+ The Vite/Next checks round-trip Invoke with NetworkID and HookParameters through
75
+ the built package. JSON import attributes require a compatible Node/bundler;
76
+ older bundlers are not claimed supported. RPC cancellation uses AbortController
77
+ with a cleaned-up timer, not AbortSignal.any/timeout.
78
+
79
+ After building packages, rerun `node scripts/check-xahau-consumers.mjs` with
80
+ Playwright and Chrome available (`PLAYWRIGHT_MODULE_PATH` may point to an
81
+ external Playwright installation). Fixtures stay under ignored `tmp/`.
@@ -0,0 +1,9 @@
1
+ import type { WalletNetwork, WalletProtocol } from "@xrpl-wallet-kit/core";
2
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
3
+ type Json = Record<string, unknown>;
4
+ export type XahauRpcRequest = (network: WalletNetwork, method: string, params: Json, signal?: AbortSignal) => Promise<Json>;
5
+ export declare function requestXahauRpc(network: WalletNetwork, method: string, params: Json, signal?: AbortSignal): Promise<Json>;
6
+ export declare function createXahauProtocol(options?: {
7
+ readonly request?: XahauRpcRequest;
8
+ }): WalletProtocol;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAqC,aAAa,EAAE,cAAc,EAAyB,MAAM,uBAAuB,CAAC;AAGrI,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACpC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAc5H,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/H;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAO,GAAG,cAAc,CAmJxG"}
package/dist/index.js ADDED
@@ -0,0 +1,236 @@
1
+ import { XrplDefinitions, encode, decode, encodeForSigning } from "xahau-binary-codec";
2
+ import definitionsData from "xahau-binary-codec/dist/enums/definitions.json" with { type: "json" };
3
+ import { deriveAddress, verify } from "ripple-keypairs";
4
+ import { sha512 } from "@noble/hashes/sha512";
5
+ import { isValidClassicAddress } from "xahau-address-codec";
6
+ import { WalletKitError, WalletKitErrorCode } from "@xrpl-wallet-kit/core";
7
+ import { XAHAU_NETWORKS, XAHAU_TRANSACTION_TYPES } from "./networks.js";
8
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
9
+ const invalid = (message, cause) => new WalletKitError(WalletKitErrorCode.INVALID_REQUEST, message, { cause });
10
+ const plain = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
11
+ function same(a, b) {
12
+ if (Object.is(a, b))
13
+ return true;
14
+ if (!a || !b || typeof a !== "object" || typeof b !== "object" || Array.isArray(a) !== Array.isArray(b))
15
+ return false;
16
+ const left = a;
17
+ const right = b;
18
+ return Object.keys(left).length === Object.keys(right).length && Object.keys(left).every(key => Object.prototype.hasOwnProperty.call(right, key) && same(left[key], right[key]));
19
+ }
20
+ const drops = (value) => typeof value === "string" && /^[1-9][0-9]{0,17}$/.test(value);
21
+ const uint = (value) => Number.isInteger(value) && Number(value) >= 0 && Number(value) <= 0xffffffff;
22
+ function hash(blob) {
23
+ return Array.from(sha512(Uint8Array.from(("54584E00" + blob).match(/../g), byte => parseInt(byte, 16))).slice(0, 32), byte => byte.toString(16).padStart(2, "0")).join("").toUpperCase();
24
+ }
25
+ export async function requestXahauRpc(network, method, params, signal) {
26
+ const controller = new AbortController();
27
+ const abort = () => controller.abort(signal?.reason);
28
+ signal?.addEventListener("abort", abort, { once: true });
29
+ if (signal?.aborted)
30
+ abort();
31
+ const timer = setTimeout(() => controller.abort(new Error("Xahau RPC timed out")), 10000);
32
+ try {
33
+ const response = await fetch(network.httpRpcUrl, { method: "POST", redirect: "error", headers: { "content-type": "application/json" }, body: JSON.stringify({ method, params: [params] }), signal: controller.signal });
34
+ if (!response.ok)
35
+ throw new WalletKitError(WalletKitErrorCode.PREFLIGHT_FAILED, `Xahau RPC HTTP ${response.status}`);
36
+ const body = await response.json();
37
+ if (!plain(body) || !plain(body.result) || body.result.error || body.error)
38
+ throw new WalletKitError(WalletKitErrorCode.PREFLIGHT_FAILED, `Xahau RPC failed: ${plain(body) && plain(body.result) ? String(body.result.error ?? "missing result") : "invalid response"}`);
39
+ return body.result;
40
+ }
41
+ finally {
42
+ clearTimeout(timer);
43
+ signal?.removeEventListener("abort", abort);
44
+ }
45
+ }
46
+ export function createXahauProtocol(options = {}) {
47
+ const definitions = new XrplDefinitions(structuredClone(definitionsData));
48
+ const request = options.request ?? requestXahauRpc;
49
+ const types = XAHAU_TRANSACTION_TYPES;
50
+ const enc = (tx) => encode(tx, definitions);
51
+ const dec = (blob) => decode(blob, definitions);
52
+ function networkCheck(network) {
53
+ const preset = XAHAU_NETWORKS.find(item => item.id === network.id);
54
+ if (!preset || network.family !== "xahau" || network.networkId !== preset.networkId || network.rpcUrl !== preset.rpcUrl || network.httpRpcUrl !== preset.httpRpcUrl)
55
+ throw new WalletKitError(WalletKitErrorCode.NETWORK_NOT_SUPPORTED, "Use a registered Xahau mainnet/testnet preset");
56
+ }
57
+ function validate(input, path = "tx") {
58
+ if (!plain(input))
59
+ throw invalid(`${path}: expected an object`);
60
+ for (const key of Reflect.ownKeys(input)) {
61
+ if (typeof key !== "string")
62
+ throw invalid(`${path}: symbol field is not supported`);
63
+ const property = Object.getOwnPropertyDescriptor(input, key);
64
+ const field = definitions.field[key];
65
+ if (!Object.prototype.hasOwnProperty.call(property, "value") || !property.enumerable || !field?.isSerialized || property.value === undefined)
66
+ throw invalid(`${path}.${key}: unknown or unsupported field`);
67
+ const value = property.value;
68
+ if (field.type.name === "STArray") {
69
+ if (!Array.isArray(value) || value.length > 32 || Object.keys(value).length !== value.length)
70
+ throw invalid(`${path}.${key}: invalid array`);
71
+ for (const [index, wrapper] of value.entries()) {
72
+ if (!plain(wrapper) || Object.keys(wrapper).length !== 1)
73
+ throw invalid(`${path}.${key}[${index}]: expected one wrapper`);
74
+ const expectedWrapper = key === "HookParameters" ? "HookParameter" : key === "Memos" ? "Memo" : undefined;
75
+ if (!expectedWrapper || !Object.prototype.hasOwnProperty.call(wrapper, expectedWrapper))
76
+ throw invalid(`${path}.${key}: array not supported by this runtime`);
77
+ validate(wrapper, `${path}.${key}[${index}]`);
78
+ }
79
+ }
80
+ else if (field.type.name === "STObject") {
81
+ const allowed = key === "HookParameter" ? ["HookParameterName", "HookParameterValue"] : key === "Memo" ? ["MemoType", "MemoData", "MemoFormat"] : undefined;
82
+ if (!allowed || !plain(value) || Object.keys(value).some(name => !allowed.includes(name)))
83
+ throw invalid(`${path}.${key}: unsupported object fields`);
84
+ validate(value, `${path}.${key}`);
85
+ }
86
+ else if (field.type.name === "AccountID") {
87
+ if (typeof value !== "string" || !isValidClassicAddress(value))
88
+ throw invalid(`${path}.${key}: use classic address and explicit tag`);
89
+ }
90
+ else if (["Blob", "Hash128", "Hash160", "Hash256"].includes(field.type.name) &&
91
+ (typeof value !== "string" || !/^(?:[0-9A-F]{2})*$/.test(value)))
92
+ throw invalid(`${path}.${key}: use canonical uppercase hex`);
93
+ }
94
+ }
95
+ function strict(tx) {
96
+ validate(tx);
97
+ if (!types.includes(String(tx.TransactionType)) || tx.TxnSignature !== undefined || tx.Signers !== undefined)
98
+ throw invalid("Unsupported Xahau transaction type or signing mode");
99
+ if (!same(dec(enc(tx)), tx))
100
+ throw invalid("Xahau codec would drop or normalize request fields");
101
+ }
102
+ async function ledger(network, signal) {
103
+ networkCheck(network);
104
+ const result = await request(network, "server_info", {}, signal);
105
+ const info = plain(result.info) ? result.info : {};
106
+ const validated = plain(info.validated_ledger) ? info.validated_ledger : {};
107
+ if (info.network_id !== network.networkId)
108
+ throw new WalletKitError(WalletKitErrorCode.NETWORK_MISMATCH, "RPC network_id differs from selected chain");
109
+ if (!uint(validated.seq) || typeof validated.age !== "number" || validated.age < 0 || validated.age > 30)
110
+ throw invalid("RPC has no recent validated ledger");
111
+ return validated.seq;
112
+ }
113
+ return {
114
+ family: "xahau", networks: XAHAU_NETWORKS, transactionTypes: types, encode: enc, decode: dec,
115
+ async lookupTransaction(txHash, network, signal) {
116
+ await ledger(network, signal);
117
+ return request(network, "tx", { transaction: txHash, binary: false }, signal);
118
+ },
119
+ async prepare(input, account, network, policy) {
120
+ networkCheck(network);
121
+ if (!drops(policy.maxFeeDrops))
122
+ throw invalid("Xahau requires an explicit positive maxFeeDrops");
123
+ validate(input);
124
+ const tx = structuredClone(input);
125
+ if (tx.Account !== undefined && tx.Account !== account.address || tx.NetworkID !== undefined && tx.NetworkID !== network.networkId)
126
+ throw invalid("Account/NetworkID conflicts with connected chain");
127
+ tx.Account = account.address;
128
+ tx.NetworkID = network.networkId;
129
+ if (tx.TransactionType === "Invoke" && tx.Destination === account.address)
130
+ throw invalid("Invoke Destination must differ from Account");
131
+ tx.SigningPubKey ?? (tx.SigningPubKey = account.publicKey?.toUpperCase() ?? "");
132
+ if (tx.SigningPubKey !== "" && (typeof tx.SigningPubKey !== "string" || deriveAddress(tx.SigningPubKey) !== account.address))
133
+ throw invalid("SigningPubKey does not belong to the connected account");
134
+ tx.Flags ?? (tx.Flags = 2147483648);
135
+ if (tx.TransactionType === "Payment" && (typeof tx.Amount === "string" && (!drops(tx.Amount)) || tx.Amount === undefined))
136
+ throw invalid("Payment requires a positive Amount");
137
+ if (tx.TransactionType === "URITokenMint" && (typeof tx.URI !== "string" || !/^(?:[0-9A-F]{2}){1,256}$/.test(tx.URI)))
138
+ throw invalid("URIToken URI must be 1-256 bytes of uppercase hex");
139
+ if (String(tx.TransactionType).startsWith("URIToken") && tx.TransactionType !== "URITokenMint" &&
140
+ (typeof tx.URITokenID !== "string" || !/^[0-9A-F]{64}$/.test(tx.URITokenID)))
141
+ throw invalid("URITokenID must be 32 bytes of uppercase hex");
142
+ if (["URITokenBuy", "URITokenCreateSellOffer"].includes(String(tx.TransactionType)) && tx.Amount === undefined)
143
+ throw invalid("URIToken buy/sell requires Amount");
144
+ strict(tx);
145
+ const index = await ledger(network, policy.signal);
146
+ const data = await request(network, "account_info", { account: account.address, ledger_index: "current", queue: true }, policy.signal);
147
+ const state = plain(data.account_data) ? data.account_data : {};
148
+ if (state.Account !== account.address || !uint(state.Sequence) || state.Sequence < 1)
149
+ throw invalid("Current funded account required");
150
+ const queue = plain(data.queue_data) ? data.queue_data : undefined;
151
+ let sequence = state.Sequence;
152
+ if (queue && queue.txn_count !== 0) {
153
+ if (!uint(queue.txn_count) || !uint(queue.highest_sequence) || queue.highest_sequence < sequence || queue.auth_change_queued === true || queue.highest_sequence === 0xffffffff)
154
+ throw invalid("Account queue is incomplete or changes authorization; wait for validation");
155
+ sequence = queue.highest_sequence + 1;
156
+ }
157
+ if (tx.Sequence !== undefined && tx.Sequence !== sequence)
158
+ throw invalid("Prepared Sequence is stale");
159
+ tx.Sequence ?? (tx.Sequence = sequence);
160
+ tx.LastLedgerSequence ?? (tx.LastLedgerSequence = index + 20);
161
+ if (!uint(tx.LastLedgerSequence) || tx.LastLedgerSequence <= index || tx.LastLedgerSequence > index + 50)
162
+ throw invalid("Transaction expiry is outside the permitted window");
163
+ const fee = await request(network, "fee", { tx_blob: enc({ ...tx, Fee: "0", SigningPubKey: "" }) }, policy.signal);
164
+ const values = plain(fee.drops) ? fee.drops : {};
165
+ if (!drops(values.base_fee) || !drops(values.open_ledger_fee))
166
+ throw invalid("Transaction-aware fee response required");
167
+ const required = BigInt(values.base_fee) > BigInt(values.open_ledger_fee) ? values.base_fee : values.open_ledger_fee;
168
+ tx.Fee ?? (tx.Fee = required);
169
+ if (!drops(tx.Fee) || BigInt(tx.Fee) < BigInt(required) || BigInt(tx.Fee) > BigInt(policy.maxFeeDrops))
170
+ throw invalid("Prepared fee is invalid, below estimate, or exceeds maxFeeDrops");
171
+ strict(tx);
172
+ return tx;
173
+ },
174
+ verify(blob, expected, account, network, policy) {
175
+ networkCheck(network);
176
+ try {
177
+ if (!/^(?:[0-9A-F]{2})+$/i.test(blob) || blob.length > 262144)
178
+ throw invalid("Expected a complete signed blob");
179
+ const signed = dec(blob.toUpperCase());
180
+ const { TxnSignature, ...intent } = signed;
181
+ const key = signed.SigningPubKey;
182
+ const wanted = { ...expected, SigningPubKey: expected.SigningPubKey || key };
183
+ if (typeof key !== "string" || typeof TxnSignature !== "string" || deriveAddress(key) !== account.address ||
184
+ signed.Account !== account.address)
185
+ throw invalid("Signed account or signing key mismatch");
186
+ if (signed.NetworkID !== network.networkId)
187
+ throw invalid("Signed NetworkID mismatch");
188
+ if (!same(intent, wanted)) {
189
+ const changedFields = [...new Set([...Object.keys(wanted), ...Object.keys(intent)])]
190
+ .filter(field => !same(wanted[field], intent[field]));
191
+ // Omit cryptographic material; retain transaction fields for local integration diagnostics.
192
+ const changes = changedFields.filter(field => field !== "SigningPubKey" && field !== "Signers")
193
+ .map(field => ({ field, expected: wanted[field] ?? null, actual: intent[field] ?? null }));
194
+ throw new WalletKitError(WalletKitErrorCode.INVALID_REQUEST, `Signed fields changed: ${changedFields.join(", ")}`, { details: { changedFields, changes } });
195
+ }
196
+ if (enc(signed) !== blob.toUpperCase())
197
+ throw invalid("Signed blob is not canonical");
198
+ if (!verify(encodeForSigning(intent, definitions), TxnSignature, key))
199
+ throw invalid("Invalid transaction signature");
200
+ if (!drops(policy.maxFeeDrops) || !drops(signed.Fee) || BigInt(signed.Fee) > BigInt(policy.maxFeeDrops))
201
+ throw invalid("Signed fee exceeds the permitted limit");
202
+ return { txBlob: blob.toUpperCase(), hash: hash(blob) };
203
+ }
204
+ catch (cause) {
205
+ throw new WalletKitError(WalletKitErrorCode.SIGN_FAILED, cause instanceof WalletKitError ? `Xahau verification failed: ${cause.message}` : "Xahau signed result failed verification", { cause, details: cause instanceof WalletKitError ? cause.details : undefined });
206
+ }
207
+ },
208
+ async submit(blob, network, policy) {
209
+ const tx = dec(blob);
210
+ if (tx.NetworkID !== network.networkId || !drops(policy.maxFeeDrops) || !drops(tx.Fee) || BigInt(tx.Fee) > BigInt(policy.maxFeeDrops))
211
+ throw invalid("Submission fee/network mismatch");
212
+ const index = await ledger(network, policy.signal);
213
+ if (!uint(tx.LastLedgerSequence) || tx.LastLedgerSequence <= index)
214
+ throw invalid("Signed transaction expired before submission");
215
+ const txHash = hash(blob);
216
+ let result;
217
+ try {
218
+ result = await request(network, "submit", { tx_blob: blob }, policy.signal);
219
+ }
220
+ catch (cause) {
221
+ throw new WalletKitError(WalletKitErrorCode.SUBMIT_FAILED, "Submission outcome unknown; check the hash before retrying", { cause, details: { hash: txHash, outcomeUnknown: true } });
222
+ }
223
+ if (result.engine_result !== "tesSUCCESS" && result.engine_result !== "terQUEUED") {
224
+ const code = typeof result.engine_result === "string" ? result.engine_result : "unknown";
225
+ // Only malformed transactions are unconditionally final. Other responses are local/provisional.
226
+ const final = code.startsWith("tem");
227
+ const rejected = /^(tem|tef|tel)/.test(code);
228
+ const outcomeUnknown = !final && (!rejected || result.relayed === true || ["tefALREADY", "tefPAST_SEQ"].includes(code));
229
+ throw new WalletKitError(WalletKitErrorCode.SUBMIT_FAILED, `Xahau submission: ${code}`, {
230
+ details: { hash: txHash, engineResult: code, submissionRejected: rejected, final, outcomeUnknown, raw: result }
231
+ });
232
+ }
233
+ return { hash: txHash, txBlob: blob, signed: true, status: "submitted", raw: result };
234
+ }
235
+ };
236
+ }
@@ -0,0 +1,11 @@
1
+ import type { WalletProtocol } from "@xrpl-wallet-kit/core";
2
+ import type { XahauRpcRequest } from "./index.js";
3
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
4
+ export declare function createXahauProtocolLoader(options: {
5
+ readonly request?: XahauRpcRequest;
6
+ }, loadModule: () => Promise<{
7
+ createXahauProtocol: (options: {
8
+ readonly request?: XahauRpcRequest;
9
+ }) => WalletProtocol;
10
+ }>): WalletProtocol;
11
+ //# sourceMappingURL=lazy-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-loader.d.ts","sourceRoot":"","sources":["../src/lazy-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACvF,UAAU,EAAE,MAAM,OAAO,CAAC;IAAE,mBAAmB,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;KAAE,KAAK,cAAc,CAAA;CAAE,CAAC,GAAG,cAAc,CAkBzI"}
@@ -0,0 +1,23 @@
1
+ import { WalletKitError, WalletKitErrorCode } from "@xrpl-wallet-kit/core";
2
+ import { XAHAU_NETWORKS, XAHAU_TRANSACTION_TYPES } from "./networks.js";
3
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
4
+ export function createXahauProtocolLoader(options, loadModule) {
5
+ let runtime;
6
+ let loading;
7
+ const load = () => loading ?? (loading = loadModule().then(module => {
8
+ runtime = module.createXahauProtocol(options);
9
+ return runtime;
10
+ }).catch(error => { loading = undefined; throw error; }));
11
+ const loaded = () => {
12
+ if (!runtime)
13
+ throw new WalletKitError(WalletKitErrorCode.INVALID_REQUEST, "Prepare a Xahau transaction before using its synchronous codec.");
14
+ return runtime;
15
+ };
16
+ return {
17
+ family: "xahau", networks: XAHAU_NETWORKS, transactionTypes: XAHAU_TRANSACTION_TYPES,
18
+ prepare: async (...args) => (await load()).prepare(...args),
19
+ submit: async (...args) => (await load()).submit(...args),
20
+ lookupTransaction: async (...args) => (await load()).lookupTransaction(...args),
21
+ verify: (...args) => loaded().verify(...args), encode: (...args) => loaded().encode(...args), decode: (...args) => loaded().decode(...args)
22
+ };
23
+ }
package/dist/lazy.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import type { WalletProtocol } from "@xrpl-wallet-kit/core";
2
+ import type { XahauRpcRequest } from "./index.js";
3
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
4
+ /**
5
+ * Keep codec/definitions out of the initial ESM client chunk.
6
+ * verify/encode/decode are synchronous and require a completed runtime load via
7
+ * prepare/submit/lookupTransaction. Adapters should always await prepare first.
8
+ */
9
+ export declare function createLazyXahauProtocol(options?: {
10
+ readonly request?: XahauRpcRequest;
11
+ }): WalletProtocol;
12
+ //# sourceMappingURL=lazy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAO,GAAG,cAAc,CAE5G"}
package/dist/lazy.js ADDED
@@ -0,0 +1,10 @@
1
+ import { createXahauProtocolLoader } from "./lazy-loader.js";
2
+ export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
3
+ /**
4
+ * Keep codec/definitions out of the initial ESM client chunk.
5
+ * verify/encode/decode are synchronous and require a completed runtime load via
6
+ * prepare/submit/lookupTransaction. Adapters should always await prepare first.
7
+ */
8
+ export function createLazyXahauProtocol(options = {}) {
9
+ return createXahauProtocolLoader(options, () => import("./index.js"));
10
+ }
@@ -0,0 +1,6 @@
1
+ import type { WalletNetwork } from "@xrpl-wallet-kit/core";
2
+ export declare const XAHAU_MAINNET: WalletNetwork;
3
+ export declare const XAHAU_TESTNET: WalletNetwork;
4
+ export declare const XAHAU_NETWORKS: readonly WalletNetwork[];
5
+ export declare const XAHAU_TRANSACTION_TYPES: string[];
6
+ //# sourceMappingURL=networks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,eAAO,MAAM,aAAa,EAAE,aAEqG,CAAC;AAClI,eAAO,MAAM,aAAa,EAAE,aAE4G,CAAC;AACzI,eAAO,MAAM,cAAc,EAAE,SAAS,aAAa,EAAmC,CAAC;AACvF,eAAO,MAAM,uBAAuB,UACkE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const XAHAU_MAINNET = { id: "xahau-mainnet", family: "xahau", name: "Xahau Mainnet", networkType: "MAINNET", networkId: 21337, nativeAsset: "XAH", nativeAssetDecimals: 6,
2
+ rpcUrl: "wss://xahau.network", httpRpcUrl: "https://xahau.network", explorerTxUrl: "https://xahau.xrpl.org/transactions/{hash}", explorerAccountUrl: "https://xahau.xrpl.org/accounts/{address}",
3
+ providerHints: { xaman: "XAHAU", xyra: "xahau-mainnet", gemwallet: { chain: "XAHAU", network: "Mainnet" }, ledgerApp: "XAH" } };
4
+ export const XAHAU_TESTNET = { ...XAHAU_MAINNET, id: "xahau-testnet", name: "Xahau Testnet", networkType: "TESTNET", networkId: 21338,
5
+ rpcUrl: "wss://xahau-test.net", httpRpcUrl: "https://xahau-test.net", explorerTxUrl: "https://xahau-testnet.xrpl.org/transactions/{hash}", explorerAccountUrl: "https://xahau-testnet.xrpl.org/accounts/{address}",
6
+ providerHints: { xaman: "XAHAUTESTNET", xyra: "xahau-testnet", gemwallet: { chain: "XAHAU", network: "Testnet" }, ledgerApp: "XAH" } };
7
+ export const XAHAU_NETWORKS = [XAHAU_MAINNET, XAHAU_TESTNET];
8
+ export const XAHAU_TRANSACTION_TYPES = ["Payment", "Invoke", "TrustSet", "OfferCreate", "OfferCancel", "AccountSet",
9
+ "URITokenMint", "URITokenBurn", "URITokenBuy", "URITokenCreateSellOffer", "URITokenCancelSellOffer"];
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@xrpl-wallet-kit/xahau",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "description": "Opt-in Xahau protocol runtime for XRPL Wallet Kit.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "node": ">=18.20.0"
10
+ },
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ "./loader": {
15
+ "types": "./dist/lazy-loader.d.ts",
16
+ "import": "./dist/lazy-loader.js"
17
+ },
18
+ "./lazy": {
19
+ "types": "./dist/lazy.d.ts",
20
+ "import": "./dist/lazy.js"
21
+ },
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "README.md"
30
+ ],
31
+ "dependencies": {
32
+ "@noble/hashes": "^1.8.0",
33
+ "@xrpl-wallet-kit/core": "0.2.1",
34
+ "ripple-keypairs": "^2.0.0",
35
+ "xahau-address-codec": "^5.0.0",
36
+ "xahau-binary-codec": "2.3.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }