@secretkeylabs/xverse-agent-wallet 0.1.6 → 0.1.9
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/cli.js +183 -37
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32250,6 +32250,11 @@ class AxiosRateLimit {
|
|
|
32250
32250
|
};
|
|
32251
32251
|
}
|
|
32252
32252
|
|
|
32253
|
+
// ../utils/xClientVersion.ts
|
|
32254
|
+
var X_CLIENT_VERSION, getXClientVersion = () => X_CLIENT_VERSION, setXClientVersion = (version) => {
|
|
32255
|
+
X_CLIENT_VERSION = version;
|
|
32256
|
+
};
|
|
32257
|
+
|
|
32253
32258
|
// ../api/esplora/esploraAPiProvider.ts
|
|
32254
32259
|
class BitcoinEsploraApiProvider {
|
|
32255
32260
|
bitcoinApi;
|
|
@@ -32284,6 +32289,13 @@ class BitcoinEsploraApiProvider {
|
|
|
32284
32289
|
this.baseUrl = baseURL;
|
|
32285
32290
|
const axiosConfig = { baseURL, auth: options.basicAuth };
|
|
32286
32291
|
this.bitcoinApi = axios_default.create(axiosConfig);
|
|
32292
|
+
this.bitcoinApi.interceptors.request.use((config) => {
|
|
32293
|
+
const version = getXClientVersion();
|
|
32294
|
+
if (version) {
|
|
32295
|
+
config.headers.set("X-Client-Version", version);
|
|
32296
|
+
}
|
|
32297
|
+
return config;
|
|
32298
|
+
});
|
|
32287
32299
|
this.rateLimiter = new AxiosRateLimit(this.bitcoinApi, {
|
|
32288
32300
|
maxRPS: 10
|
|
32289
32301
|
});
|
|
@@ -32299,6 +32311,13 @@ class BitcoinEsploraApiProvider {
|
|
|
32299
32311
|
});
|
|
32300
32312
|
if (fallbackUrl) {
|
|
32301
32313
|
this.fallbackBitcoinApi = axios_default.create({ ...axiosConfig, baseURL: fallbackUrl });
|
|
32314
|
+
this.fallbackBitcoinApi.interceptors.request.use((config) => {
|
|
32315
|
+
const version = getXClientVersion();
|
|
32316
|
+
if (version) {
|
|
32317
|
+
config.headers.set("X-Client-Version", version);
|
|
32318
|
+
}
|
|
32319
|
+
return config;
|
|
32320
|
+
});
|
|
32302
32321
|
this.fallbackRateLimiter = new AxiosRateLimit(this.fallbackBitcoinApi, {
|
|
32303
32322
|
maxRPS: 10
|
|
32304
32323
|
});
|
|
@@ -32970,11 +32989,6 @@ var init_types = __esm(() => {
|
|
|
32970
32989
|
init_typescriptUtilities();
|
|
32971
32990
|
});
|
|
32972
32991
|
|
|
32973
|
-
// ../utils/xClientVersion.ts
|
|
32974
|
-
var X_CLIENT_VERSION, getXClientVersion = () => X_CLIENT_VERSION, setXClientVersion = (version) => {
|
|
32975
|
-
X_CLIENT_VERSION = version;
|
|
32976
|
-
};
|
|
32977
|
-
|
|
32978
32992
|
// ../api/ordinals/provider.ts
|
|
32979
32993
|
class OrdinalsApi {
|
|
32980
32994
|
xordClient;
|
|
@@ -161428,7 +161442,7 @@ var runeTokenToFungibleToken = (runeBalance) => ({
|
|
|
161428
161442
|
ticker: token.ticker,
|
|
161429
161443
|
name: token.ticker,
|
|
161430
161444
|
assetName: token.ticker,
|
|
161431
|
-
principal: token.
|
|
161445
|
+
principal: token.identifier,
|
|
161432
161446
|
balance: "0",
|
|
161433
161447
|
total_received: "0",
|
|
161434
161448
|
total_sent: "0"
|
|
@@ -210744,8 +210758,10 @@ var init_xverse2 = __esm(() => {
|
|
|
210744
210758
|
const response = await this.authenticatedClient.get(`/v1/due/virtual-accounts/${id}`);
|
|
210745
210759
|
return response.data;
|
|
210746
210760
|
},
|
|
210747
|
-
getChannels: async () => {
|
|
210748
|
-
const response = await this.authenticatedClient.get(
|
|
210761
|
+
getChannels: async (params) => {
|
|
210762
|
+
const response = await this.authenticatedClient.get(`/v1/due/channels`, {
|
|
210763
|
+
params
|
|
210764
|
+
});
|
|
210749
210765
|
return response.data;
|
|
210750
210766
|
},
|
|
210751
210767
|
createQuote: async (body) => {
|
|
@@ -240555,20 +240571,18 @@ function sortDueCurrenciesByPriority(currencies, priorityCodes = DUE_PRIORITY_CU
|
|
|
240555
240571
|
});
|
|
240556
240572
|
}
|
|
240557
240573
|
function mapDueChannelsToCurrencies(channels) {
|
|
240558
|
-
const
|
|
240559
|
-
const result = [];
|
|
240574
|
+
const availabilityMap = new Map;
|
|
240560
240575
|
for (const ch of channels) {
|
|
240561
240576
|
const code = ch.currencyCode;
|
|
240562
|
-
if (!code ||
|
|
240577
|
+
if (!code || !DUE_SUPPORTED_CURRENCIES[code]) {
|
|
240563
240578
|
continue;
|
|
240564
240579
|
}
|
|
240565
|
-
|
|
240580
|
+
availabilityMap.set(code, (availabilityMap.get(code) ?? false) || ch.isAvailable);
|
|
240581
|
+
}
|
|
240582
|
+
const result = [];
|
|
240583
|
+
for (const [code, isAvailable] of availabilityMap) {
|
|
240566
240584
|
const info = DUE_SUPPORTED_CURRENCIES[code];
|
|
240567
|
-
result.push({
|
|
240568
|
-
code,
|
|
240569
|
-
name: info.name,
|
|
240570
|
-
flag: info.flag
|
|
240571
|
-
});
|
|
240585
|
+
result.push({ code, name: info.name, flag: info.flag, isAvailable });
|
|
240572
240586
|
}
|
|
240573
240587
|
return result;
|
|
240574
240588
|
}
|
|
@@ -242130,7 +242144,7 @@ async function aesGcmEncrypt(plaintext, passwordHash) {
|
|
|
242130
242144
|
const iv = crypto.getRandomValues(new Uint8Array(IV_SIZE));
|
|
242131
242145
|
const data = Buffer.from(plaintext, "utf-8");
|
|
242132
242146
|
const alg = { name: "AES-GCM", iv };
|
|
242133
|
-
const key = await crypto.subtle.importKey("raw",
|
|
242147
|
+
const key = await crypto.subtle.importKey("raw", utf8StrToBytes(passwordHash), alg, false, ["encrypt", "decrypt"]);
|
|
242134
242148
|
const encrypted = await crypto.subtle.encrypt(alg, key, data);
|
|
242135
242149
|
const buffer = new Uint8Array(encrypted);
|
|
242136
242150
|
const cipherIv = concatBuffers(iv, buffer);
|
|
@@ -242141,12 +242155,12 @@ async function aesGcmDecrypt(cipherText, passwordHash) {
|
|
|
242141
242155
|
const data = cipher.subarray(IV_SIZE);
|
|
242142
242156
|
const iv = cipher.subarray(0, IV_SIZE);
|
|
242143
242157
|
const alg = { name: "AES-GCM", iv };
|
|
242144
|
-
const key = await crypto.subtle.importKey("raw",
|
|
242158
|
+
const key = await crypto.subtle.importKey("raw", utf8StrToBytes(passwordHash), alg, false, ["encrypt", "decrypt"]);
|
|
242145
242159
|
const plainBuffer = await crypto.subtle.decrypt(alg, key, data);
|
|
242146
242160
|
const plaintext = new TextDecoder().decode(plainBuffer);
|
|
242147
242161
|
return plaintext;
|
|
242148
242162
|
}
|
|
242149
|
-
var IV_SIZE = 16;
|
|
242163
|
+
var utf8StrToBytes = (value) => new TextEncoder().encode(value), IV_SIZE = 16;
|
|
242150
242164
|
var init_aes = __esm(() => {
|
|
242151
242165
|
init_utils6();
|
|
242152
242166
|
});
|
|
@@ -371833,7 +371847,41 @@ import { mkdir as mkdir2, readFile as readFile2, rm as rm2, writeFile as writeFi
|
|
|
371833
371847
|
import { homedir as homedir3 } from "os";
|
|
371834
371848
|
import { dirname as dirname2, join as join7 } from "path";
|
|
371835
371849
|
import { fileURLToPath } from "url";
|
|
371836
|
-
var SKILL_DIR_NAME = "xverse-agent-wallet", SKILL_FILE = "SKILL.md", green = (s2) => `\x1B[32m${s2}\x1B[0m`,
|
|
371850
|
+
var SKILL_DIR_NAME = "xverse-agent-wallet", SKILL_FILE = "SKILL.md", green = (s2) => `\x1B[32m${s2}\x1B[0m`, dim = (s2) => `\x1B[2m${s2}\x1B[0m`, stripFrontmatter = (content) => {
|
|
371851
|
+
const match3 = content.match(/^---\n[\s\S]*?\n---\n/);
|
|
371852
|
+
return match3 ? content.slice(match3[0].length) : content;
|
|
371853
|
+
}, extractDescription = (content) => {
|
|
371854
|
+
const match3 = content.match(/^---\n[\s\S]*?description:\s*['"]?(.+?)['"]?\s*\n[\s\S]*?---\n/);
|
|
371855
|
+
return match3?.[1] ?? "Xverse wallet CLI for AI agents";
|
|
371856
|
+
}, toHermesMd = (content) => {
|
|
371857
|
+
const name = "xverse-wallet-cli";
|
|
371858
|
+
const desc = extractDescription(content);
|
|
371859
|
+
const body = stripFrontmatter(content);
|
|
371860
|
+
return `---
|
|
371861
|
+
name: ${name}
|
|
371862
|
+
description: '${desc}'
|
|
371863
|
+
version: 1.0.0
|
|
371864
|
+
metadata:
|
|
371865
|
+
hermes:
|
|
371866
|
+
tags: [bitcoin, crypto, wallet, lightning, stacks, runes]
|
|
371867
|
+
category: crypto
|
|
371868
|
+
requires_toolsets: [terminal]
|
|
371869
|
+
required_environment_variables:
|
|
371870
|
+
- name: XVERSE_PASSWORD
|
|
371871
|
+
prompt: Wallet password
|
|
371872
|
+
help: Set during wallet creation via xverse-wallet agent
|
|
371873
|
+
required_for: full functionality
|
|
371874
|
+
---
|
|
371875
|
+
${body}`;
|
|
371876
|
+
}, toCursorMdc = (content) => {
|
|
371877
|
+
const desc = extractDescription(content);
|
|
371878
|
+
const body = stripFrontmatter(content);
|
|
371879
|
+
return `---
|
|
371880
|
+
description: ${desc}
|
|
371881
|
+
alwaysApply: false
|
|
371882
|
+
---
|
|
371883
|
+
${body}`;
|
|
371884
|
+
}, home, AGENT_TARGETS, findPackageRoot = () => {
|
|
371837
371885
|
let dir = dirname2(fileURLToPath(import.meta.url));
|
|
371838
371886
|
for (let i2 = 0;i2 < 5; i2++) {
|
|
371839
371887
|
if (existsSync3(join7(dir, "package.json")))
|
|
@@ -371855,24 +371903,106 @@ var SKILL_DIR_NAME = "xverse-agent-wallet", SKILL_FILE = "SKILL.md", green = (s2
|
|
|
371855
371903
|
${candidates.join(`
|
|
371856
371904
|
`)}`);
|
|
371857
371905
|
}, installSkill = async () => {
|
|
371858
|
-
const
|
|
371859
|
-
|
|
371860
|
-
|
|
371861
|
-
|
|
371906
|
+
const content = await getSkillContent();
|
|
371907
|
+
const installed = [];
|
|
371908
|
+
const skipped = [];
|
|
371909
|
+
for (const target of AGENT_TARGETS) {
|
|
371910
|
+
if (!existsSync3(target.detectDir)) {
|
|
371911
|
+
skipped.push(target.name);
|
|
371912
|
+
continue;
|
|
371913
|
+
}
|
|
371914
|
+
const dir = dirname2(target.installPath);
|
|
371915
|
+
await mkdir2(dir, { recursive: true });
|
|
371916
|
+
await writeFile2(target.installPath, target.transform(content), "utf-8");
|
|
371917
|
+
installed.push(target.name);
|
|
371918
|
+
}
|
|
371919
|
+
if (installed.length === 0 && skipped.length === AGENT_TARGETS.length) {
|
|
371920
|
+
console.error("No supported AI agents detected. Install one of: Claude Code, Cursor, Windsurf, Cline, Codex CLI, OpenClaw, Hermes, or GitHub Copilot — then re-run: xverse-wallet --install");
|
|
371862
371921
|
return;
|
|
371863
371922
|
}
|
|
371864
|
-
|
|
371865
|
-
|
|
371866
|
-
|
|
371867
|
-
|
|
371868
|
-
|
|
371869
|
-
|
|
371923
|
+
console.error("Installed xverse-wallet skill:");
|
|
371924
|
+
for (const target of AGENT_TARGETS) {
|
|
371925
|
+
const path2 = target.installPath.replace(home, "~");
|
|
371926
|
+
if (installed.includes(target.name)) {
|
|
371927
|
+
console.error(green(` ✓ ${target.name.padEnd(12)} ${path2}`));
|
|
371928
|
+
} else {
|
|
371929
|
+
console.error(dim(` - ${target.name.padEnd(12)} not detected`));
|
|
371930
|
+
}
|
|
371931
|
+
}
|
|
371870
371932
|
}, uninstallSkill = async () => {
|
|
371871
|
-
const
|
|
371872
|
-
|
|
371873
|
-
|
|
371933
|
+
const removed = [];
|
|
371934
|
+
for (const target of AGENT_TARGETS) {
|
|
371935
|
+
if (!existsSync3(target.installPath))
|
|
371936
|
+
continue;
|
|
371937
|
+
if (target.removeDir) {
|
|
371938
|
+
await rm2(dirname2(target.installPath), { recursive: true, force: true });
|
|
371939
|
+
} else {
|
|
371940
|
+
await rm2(target.installPath, { force: true });
|
|
371941
|
+
}
|
|
371942
|
+
removed.push(target.name);
|
|
371943
|
+
}
|
|
371944
|
+
if (removed.length === 0) {
|
|
371945
|
+
console.error("Nothing to uninstall.");
|
|
371946
|
+
return;
|
|
371947
|
+
}
|
|
371948
|
+
console.error(green(`Removed xverse-wallet skill from: ${removed.join(", ")}`));
|
|
371874
371949
|
};
|
|
371875
|
-
var init_install = () => {
|
|
371950
|
+
var init_install = __esm(() => {
|
|
371951
|
+
home = homedir3();
|
|
371952
|
+
AGENT_TARGETS = [
|
|
371953
|
+
{
|
|
371954
|
+
name: "Claude Code",
|
|
371955
|
+
detectDir: join7(home, ".claude"),
|
|
371956
|
+
installPath: join7(home, ".claude", "skills", SKILL_DIR_NAME, SKILL_FILE),
|
|
371957
|
+
transform: (c2) => c2,
|
|
371958
|
+
removeDir: true
|
|
371959
|
+
},
|
|
371960
|
+
{
|
|
371961
|
+
name: "Cursor",
|
|
371962
|
+
detectDir: join7(home, ".cursor"),
|
|
371963
|
+
installPath: join7(home, ".cursor", "rules", `${SKILL_DIR_NAME}.mdc`),
|
|
371964
|
+
transform: toCursorMdc
|
|
371965
|
+
},
|
|
371966
|
+
{
|
|
371967
|
+
name: "Windsurf",
|
|
371968
|
+
detectDir: join7(home, ".codeium", "windsurf"),
|
|
371969
|
+
installPath: join7(home, ".codeium", "windsurf", "memories", `${SKILL_DIR_NAME}.md`),
|
|
371970
|
+
transform: stripFrontmatter
|
|
371971
|
+
},
|
|
371972
|
+
{
|
|
371973
|
+
name: "Cline",
|
|
371974
|
+
detectDir: join7(home, ".cline"),
|
|
371975
|
+
installPath: join7(home, ".cline", "rules", `${SKILL_DIR_NAME}.md`),
|
|
371976
|
+
transform: stripFrontmatter
|
|
371977
|
+
},
|
|
371978
|
+
{
|
|
371979
|
+
name: "Codex CLI",
|
|
371980
|
+
detectDir: join7(home, ".codex"),
|
|
371981
|
+
installPath: join7(home, ".codex", "instructions", `${SKILL_DIR_NAME}.md`),
|
|
371982
|
+
transform: stripFrontmatter
|
|
371983
|
+
},
|
|
371984
|
+
{
|
|
371985
|
+
name: "OpenClaw",
|
|
371986
|
+
detectDir: join7(home, ".openclaw"),
|
|
371987
|
+
installPath: join7(home, ".openclaw", "skills", SKILL_DIR_NAME, SKILL_FILE),
|
|
371988
|
+
transform: (c2) => c2,
|
|
371989
|
+
removeDir: true
|
|
371990
|
+
},
|
|
371991
|
+
{
|
|
371992
|
+
name: "Hermes",
|
|
371993
|
+
detectDir: join7(home, ".hermes"),
|
|
371994
|
+
installPath: join7(home, ".hermes", "skills", "crypto", SKILL_DIR_NAME, SKILL_FILE),
|
|
371995
|
+
transform: toHermesMd,
|
|
371996
|
+
removeDir: true
|
|
371997
|
+
},
|
|
371998
|
+
{
|
|
371999
|
+
name: "GitHub Copilot",
|
|
372000
|
+
detectDir: join7(home, ".config", "github-copilot"),
|
|
372001
|
+
installPath: join7(home, ".config", "github-copilot", "instructions", `${SKILL_DIR_NAME}.md`),
|
|
372002
|
+
transform: stripFrontmatter
|
|
372003
|
+
}
|
|
372004
|
+
];
|
|
372005
|
+
});
|
|
371876
372006
|
|
|
371877
372007
|
// index.ts
|
|
371878
372008
|
init_xverse_core_private();
|
|
@@ -371952,6 +372082,22 @@ import { mkdir, readFile, writeFile } from "fs/promises";
|
|
|
371952
372082
|
import { dirname, join as join3 } from "path";
|
|
371953
372083
|
import * as v26 from "valibot";
|
|
371954
372084
|
var storageSchema = v26.record(v26.string(), v26.string());
|
|
372085
|
+
function createInMemoryStorageAdapter() {
|
|
372086
|
+
const cache = {};
|
|
372087
|
+
return {
|
|
372088
|
+
get: async (key) => cache[key] ?? null,
|
|
372089
|
+
getMany: async (...keys) => {
|
|
372090
|
+
return Object.fromEntries(keys.map((key) => [key, key in cache ? cache[key] : undefined]));
|
|
372091
|
+
},
|
|
372092
|
+
set: async (key, value) => {
|
|
372093
|
+
cache[key] = value;
|
|
372094
|
+
},
|
|
372095
|
+
remove: async (key) => {
|
|
372096
|
+
delete cache[key];
|
|
372097
|
+
},
|
|
372098
|
+
getAllKeys: async () => Object.keys(cache)
|
|
372099
|
+
};
|
|
372100
|
+
}
|
|
371955
372101
|
function createFileStorageAdapter(namespace2) {
|
|
371956
372102
|
const filePath = join3(getVaultsPath(), `${namespace2}.json`);
|
|
371957
372103
|
let cache = {};
|
|
@@ -372007,7 +372153,7 @@ function createFileStorageAdapter(namespace2) {
|
|
|
372007
372153
|
var createVault = () => {
|
|
372008
372154
|
return new MasterVault({
|
|
372009
372155
|
cryptoUtilsAdapter: cryptoAdapter,
|
|
372010
|
-
sessionStorageAdapter:
|
|
372156
|
+
sessionStorageAdapter: createInMemoryStorageAdapter(),
|
|
372011
372157
|
encryptedDataStorageAdapter: createFileStorageAdapter("encrypted"),
|
|
372012
372158
|
commonStorageAdapter: createFileStorageAdapter("common")
|
|
372013
372159
|
});
|
|
@@ -380335,7 +380481,7 @@ Run with --yes to confirm.`,
|
|
|
380335
380481
|
};
|
|
380336
380482
|
|
|
380337
380483
|
// index.ts
|
|
380338
|
-
var cliVersion = "0.1.
|
|
380484
|
+
var cliVersion = "0.1.9";
|
|
380339
380485
|
setXClientVersion(`xverse-agent-wallet/${cliVersion}`);
|
|
380340
380486
|
var program = new Command;
|
|
380341
380487
|
program.name("xverse-wallet").version(cliVersion).description("Xverse wallet CLI");
|