@xrpl-wallet-kit/xahau 0.2.1 → 0.3.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -79
- package/dist/lazy-loader.d.ts.map +1 -1
- package/dist/lazy-loader.js +10 -0
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;AAEpC,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,CAuLxG"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import definitionsData from "xahau-binary-codec/dist/enums/definitions.json" wit
|
|
|
3
3
|
import { deriveAddress, verify } from "ripple-keypairs";
|
|
4
4
|
import { sha512 } from "@noble/hashes/sha512";
|
|
5
5
|
import { isValidClassicAddress } from "xahau-address-codec";
|
|
6
|
-
import { WalletKitError, WalletKitErrorCode } from "@xrpl-wallet-kit/core";
|
|
6
|
+
import { WalletKitError, WalletKitErrorCode, assertWalletRequestActive } from "@xrpl-wallet-kit/core";
|
|
7
7
|
import { XAHAU_NETWORKS, XAHAU_TRANSACTION_TYPES } from "./networks.js";
|
|
8
8
|
export { XAHAU_MAINNET, XAHAU_TESTNET, XAHAU_NETWORKS } from "./networks.js";
|
|
9
|
+
const POST_SIGN_MAX_AGE_MS = 5000;
|
|
9
10
|
const invalid = (message, cause) => new WalletKitError(WalletKitErrorCode.INVALID_REQUEST, message, { cause });
|
|
10
11
|
const plain = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
|
|
11
12
|
function same(a, b) {
|
|
@@ -110,66 +111,103 @@ export function createXahauProtocol(options = {}) {
|
|
|
110
111
|
throw invalid("RPC has no recent validated ledger");
|
|
111
112
|
return validated.seq;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
async function prepareTransaction(input, account, network, policy) {
|
|
115
|
+
networkCheck(network);
|
|
116
|
+
if (!drops(policy.maxFeeDrops))
|
|
117
|
+
throw invalid("Xahau requires an explicit positive maxFeeDrops");
|
|
118
|
+
validate(input);
|
|
119
|
+
const tx = structuredClone(input);
|
|
120
|
+
if (tx.Account !== undefined && tx.Account !== account.address || tx.NetworkID !== undefined && tx.NetworkID !== network.networkId)
|
|
121
|
+
throw invalid("Account/NetworkID conflicts with connected chain");
|
|
122
|
+
tx.Account = account.address;
|
|
123
|
+
tx.NetworkID = network.networkId;
|
|
124
|
+
if (tx.TransactionType === "Invoke" && tx.Destination === account.address)
|
|
125
|
+
throw invalid("Invoke Destination must differ from Account");
|
|
126
|
+
tx.SigningPubKey ?? (tx.SigningPubKey = account.publicKey?.toUpperCase() ?? "");
|
|
127
|
+
if (tx.SigningPubKey !== "" && (typeof tx.SigningPubKey !== "string" || deriveAddress(tx.SigningPubKey) !== account.address))
|
|
128
|
+
throw invalid("SigningPubKey does not belong to the connected account");
|
|
129
|
+
tx.Flags ?? (tx.Flags = 2147483648);
|
|
130
|
+
if (tx.TransactionType === "Payment" && (typeof tx.Amount === "string" && (!drops(tx.Amount)) || tx.Amount === undefined))
|
|
131
|
+
throw invalid("Payment requires a positive Amount");
|
|
132
|
+
if (tx.TransactionType === "URITokenMint" && (typeof tx.URI !== "string" || !/^(?:[0-9A-F]{2}){1,256}$/.test(tx.URI)))
|
|
133
|
+
throw invalid("URIToken URI must be 1-256 bytes of uppercase hex");
|
|
134
|
+
if (String(tx.TransactionType).startsWith("URIToken") && tx.TransactionType !== "URITokenMint" &&
|
|
135
|
+
(typeof tx.URITokenID !== "string" || !/^[0-9A-F]{64}$/.test(tx.URITokenID)))
|
|
136
|
+
throw invalid("URITokenID must be 32 bytes of uppercase hex");
|
|
137
|
+
if (["URITokenBuy", "URITokenCreateSellOffer"].includes(String(tx.TransactionType)) && tx.Amount === undefined)
|
|
138
|
+
throw invalid("URIToken buy/sell requires Amount");
|
|
139
|
+
strict(tx);
|
|
140
|
+
const feeParams = () => ({ tx_blob: enc({ ...tx, Fee: "0", SigningPubKey: "" }) });
|
|
141
|
+
const [index, data, knownFee] = await Promise.all([
|
|
142
|
+
ledger(network, policy.signal),
|
|
143
|
+
request(network, "account_info", { account: account.address, ledger_index: "current", queue: true }, policy.signal),
|
|
144
|
+
// A fully prepared signed intent already has the fields needed for its fee quote.
|
|
145
|
+
tx.Sequence !== undefined && tx.LastLedgerSequence !== undefined
|
|
146
|
+
? request(network, "fee", feeParams(), policy.signal) : Promise.resolve(undefined)
|
|
147
|
+
]);
|
|
148
|
+
assertWalletRequestActive(policy.signal);
|
|
149
|
+
const state = plain(data.account_data) ? data.account_data : {};
|
|
150
|
+
if (state.Account !== account.address || !uint(state.Sequence) || state.Sequence < 1)
|
|
151
|
+
throw invalid("Current funded account required");
|
|
152
|
+
const queue = plain(data.queue_data) ? data.queue_data : undefined;
|
|
153
|
+
let sequence = state.Sequence;
|
|
154
|
+
if (queue && queue.txn_count !== 0) {
|
|
155
|
+
if (!uint(queue.txn_count) || !uint(queue.highest_sequence) || queue.highest_sequence < sequence || queue.auth_change_queued === true || queue.highest_sequence === 0xffffffff)
|
|
156
|
+
throw invalid("Account queue is incomplete or changes authorization; wait for validation");
|
|
157
|
+
sequence = queue.highest_sequence + 1;
|
|
158
|
+
}
|
|
159
|
+
if (tx.Sequence !== undefined && tx.Sequence !== sequence)
|
|
160
|
+
throw invalid("Prepared Sequence is stale");
|
|
161
|
+
tx.Sequence ?? (tx.Sequence = sequence);
|
|
162
|
+
tx.LastLedgerSequence ?? (tx.LastLedgerSequence = index + 20);
|
|
163
|
+
if (!uint(tx.LastLedgerSequence) || tx.LastLedgerSequence <= index || tx.LastLedgerSequence > index + 50)
|
|
164
|
+
throw invalid("Transaction expiry is outside the permitted window");
|
|
165
|
+
const fee = knownFee ?? await request(network, "fee", feeParams(), policy.signal);
|
|
166
|
+
assertWalletRequestActive(policy.signal);
|
|
167
|
+
const values = plain(fee.drops) ? fee.drops : {};
|
|
168
|
+
if (!drops(values.base_fee) || !drops(values.open_ledger_fee))
|
|
169
|
+
throw invalid("Transaction-aware fee response required");
|
|
170
|
+
const required = BigInt(values.base_fee) > BigInt(values.open_ledger_fee) ? values.base_fee : values.open_ledger_fee;
|
|
171
|
+
tx.Fee ?? (tx.Fee = required);
|
|
172
|
+
if (!drops(tx.Fee) || BigInt(tx.Fee) < BigInt(required) || BigInt(tx.Fee) > BigInt(policy.maxFeeDrops))
|
|
173
|
+
throw invalid("Prepared fee is invalid, below estimate, or exceeds maxFeeDrops");
|
|
174
|
+
strict(tx);
|
|
175
|
+
return { tx, index };
|
|
176
|
+
}
|
|
177
|
+
async function submitAtHead(blob, network, policy, index) {
|
|
178
|
+
const tx = dec(blob);
|
|
179
|
+
if (tx.NetworkID !== network.networkId || !drops(policy.maxFeeDrops) || !drops(tx.Fee) || BigInt(tx.Fee) > BigInt(policy.maxFeeDrops))
|
|
180
|
+
throw invalid("Submission fee/network mismatch");
|
|
181
|
+
if (!uint(tx.LastLedgerSequence) || tx.LastLedgerSequence <= index)
|
|
182
|
+
throw invalid("Signed transaction expired before submission");
|
|
183
|
+
const txHash = hash(blob);
|
|
184
|
+
let result;
|
|
185
|
+
try {
|
|
186
|
+
result = await request(network, "submit", { tx_blob: blob }, policy.signal);
|
|
187
|
+
}
|
|
188
|
+
catch (cause) {
|
|
189
|
+
throw new WalletKitError(WalletKitErrorCode.SUBMIT_FAILED, "Submission outcome unknown; check the hash before retrying", { cause, details: { hash: txHash, outcomeUnknown: true } });
|
|
190
|
+
}
|
|
191
|
+
if (result.engine_result !== "tesSUCCESS" && result.engine_result !== "terQUEUED") {
|
|
192
|
+
const code = typeof result.engine_result === "string" ? result.engine_result : "unknown";
|
|
193
|
+
// Only malformed transactions are unconditionally final. Other responses are local/provisional.
|
|
194
|
+
const final = code.startsWith("tem");
|
|
195
|
+
const rejected = /^(tem|tef|tel)/.test(code);
|
|
196
|
+
const outcomeUnknown = !final && (!rejected || result.relayed === true || ["tefALREADY", "tefPAST_SEQ"].includes(code));
|
|
197
|
+
throw new WalletKitError(WalletKitErrorCode.SUBMIT_FAILED, `Xahau submission: ${code}`, {
|
|
198
|
+
details: { hash: txHash, engineResult: code, submissionRejected: rejected, final, outcomeUnknown, raw: result }
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return { hash: txHash, txBlob: blob, signed: true, status: "submitted", raw: result };
|
|
202
|
+
}
|
|
203
|
+
const protocol = {
|
|
114
204
|
family: "xahau", networks: XAHAU_NETWORKS, transactionTypes: types, encode: enc, decode: dec,
|
|
115
205
|
async lookupTransaction(txHash, network, signal) {
|
|
116
206
|
await ledger(network, signal);
|
|
117
207
|
return request(network, "tx", { transaction: txHash, binary: false }, signal);
|
|
118
208
|
},
|
|
119
209
|
async prepare(input, account, network, policy) {
|
|
120
|
-
|
|
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;
|
|
210
|
+
return (await prepareTransaction(input, account, network, policy)).tx;
|
|
173
211
|
},
|
|
174
212
|
verify(blob, expected, account, network, policy) {
|
|
175
213
|
networkCheck(network);
|
|
@@ -205,32 +243,32 @@ export function createXahauProtocol(options = {}) {
|
|
|
205
243
|
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
244
|
}
|
|
207
245
|
},
|
|
246
|
+
async verifyAndSubmit(blob, expected, account, network, policy, assertCurrent) {
|
|
247
|
+
// No reusable proof escapes this operation. Snapshot inputs before any RPC can yield.
|
|
248
|
+
const selected = structuredClone(network);
|
|
249
|
+
const signer = structuredClone(account);
|
|
250
|
+
const intent = structuredClone(expected);
|
|
251
|
+
const limits = { maxFeeDrops: policy.maxFeeDrops, signal: policy.signal };
|
|
252
|
+
assertCurrent();
|
|
253
|
+
assertWalletRequestActive(limits.signal);
|
|
254
|
+
const verified = protocol.verify(blob, intent, signer, selected, limits);
|
|
255
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
256
|
+
const started = Date.now();
|
|
257
|
+
const fresh = await prepareTransaction(intent, signer, selected, limits);
|
|
258
|
+
assertCurrent();
|
|
259
|
+
assertWalletRequestActive(limits.signal);
|
|
260
|
+
const age = Date.now() - started;
|
|
261
|
+
if (age >= 0 && age <= POST_SIGN_MAX_AGE_MS)
|
|
262
|
+
return submitAtHead(verified.txBlob, selected, limits, fresh.index);
|
|
263
|
+
}
|
|
264
|
+
throw new WalletKitError(WalletKitErrorCode.PREFLIGHT_FAILED, "Post-sign validation expired; retry signing.");
|
|
265
|
+
},
|
|
208
266
|
async submit(blob, network, policy) {
|
|
209
|
-
|
|
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");
|
|
267
|
+
assertWalletRequestActive(policy.signal);
|
|
212
268
|
const index = await ledger(network, policy.signal);
|
|
213
|
-
|
|
214
|
-
|
|
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 };
|
|
269
|
+
assertWalletRequestActive(policy.signal);
|
|
270
|
+
return submitAtHead(blob, network, policy, index);
|
|
234
271
|
}
|
|
235
272
|
};
|
|
273
|
+
return protocol;
|
|
236
274
|
}
|
|
@@ -1 +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,
|
|
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,CA2BzI"}
|
package/dist/lazy-loader.js
CHANGED
|
@@ -17,6 +17,16 @@ export function createXahauProtocolLoader(options, loadModule) {
|
|
|
17
17
|
family: "xahau", networks: XAHAU_NETWORKS, transactionTypes: XAHAU_TRANSACTION_TYPES,
|
|
18
18
|
prepare: async (...args) => (await load()).prepare(...args),
|
|
19
19
|
submit: async (...args) => (await load()).submit(...args),
|
|
20
|
+
verifyAndSubmit: async (blob, expected, account, network, policy, assertCurrent) => {
|
|
21
|
+
const protocol = await load();
|
|
22
|
+
if (protocol.verifyAndSubmit)
|
|
23
|
+
return protocol.verifyAndSubmit(blob, expected, account, network, policy, assertCurrent);
|
|
24
|
+
assertCurrent();
|
|
25
|
+
const verified = protocol.verify(blob, expected, account, network, policy);
|
|
26
|
+
await protocol.prepare(expected, account, network, policy);
|
|
27
|
+
assertCurrent();
|
|
28
|
+
return { ...await protocol.submit(verified.txBlob, network, policy), txBlob: verified.txBlob };
|
|
29
|
+
},
|
|
20
30
|
lookupTransaction: async (...args) => (await load()).lookupTransaction(...args),
|
|
21
31
|
verify: (...args) => loaded().verify(...args), encode: (...args) => loaded().encode(...args), decode: (...args) => loaded().decode(...args)
|
|
22
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xrpl-wallet-kit/xahau",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Opt-in Xahau protocol runtime for XRPL Wallet Kit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@noble/hashes": "^1.8.0",
|
|
33
|
-
"@xrpl-wallet-kit/core": "0.
|
|
33
|
+
"@xrpl-wallet-kit/core": "0.3.0",
|
|
34
34
|
"ripple-keypairs": "^2.0.0",
|
|
35
35
|
"xahau-address-codec": "^5.0.0",
|
|
36
36
|
"xahau-binary-codec": "2.3.0"
|