@aibtc/mcp-server 1.44.0 → 1.45.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/config/sponsor.d.ts +8 -0
- package/dist/config/sponsor.d.ts.map +1 -1
- package/dist/config/sponsor.js +10 -0
- package/dist/config/sponsor.js.map +1 -1
- package/dist/services/hiro-api.d.ts +3 -0
- package/dist/services/hiro-api.d.ts.map +1 -1
- package/dist/services/hiro-api.js.map +1 -1
- package/dist/tools/arxiv-research.tools.d.ts +16 -0
- package/dist/tools/arxiv-research.tools.d.ts.map +1 -0
- package/dist/tools/arxiv-research.tools.js +433 -0
- package/dist/tools/arxiv-research.tools.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nonce.tools.d.ts.map +1 -1
- package/dist/tools/nonce.tools.js +492 -25
- package/dist/tools/nonce.tools.js.map +1 -1
- package/dist/tools/skill-mappings.d.ts.map +1 -1
- package/dist/tools/skill-mappings.js +20 -9
- package/dist/tools/skill-mappings.js.map +1 -1
- package/dist/tools/yield-dashboard.tools.d.ts +17 -0
- package/dist/tools/yield-dashboard.tools.d.ts.map +1 -0
- package/dist/tools/yield-dashboard.tools.js +559 -0
- package/dist/tools/yield-dashboard.tools.js.map +1 -0
- package/dist/transactions/builder.d.ts +4 -0
- package/dist/transactions/builder.d.ts.map +1 -1
- package/dist/transactions/builder.js.map +1 -1
- package/dist/transactions/sponsor-builder.d.ts +6 -12
- package/dist/transactions/sponsor-builder.d.ts.map +1 -1
- package/dist/transactions/sponsor-builder.js +81 -39
- package/dist/transactions/sponsor-builder.js.map +1 -1
- package/dist/utils/relay-health.d.ts +14 -5
- package/dist/utils/relay-health.d.ts.map +1 -1
- package/dist/utils/relay-health.js +60 -76
- package/dist/utils/relay-health.js.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
|
@@ -13,24 +13,18 @@ export interface SponsorRelayResponse {
|
|
|
13
13
|
retryAfter?: number;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* This is the primary entry point for services that need sponsored contract calls.
|
|
16
|
+
* Build and submit a sponsored contract call via the relay.
|
|
17
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
20
18
|
*/
|
|
21
19
|
export declare function sponsoredContractCall(account: Account, options: ContractCallOptions, network: Network): Promise<TransferResult>;
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* This is the primary entry point for services that need sponsored STX transfers.
|
|
21
|
+
* Build and submit a sponsored STX transfer via the relay.
|
|
22
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
27
23
|
*/
|
|
28
24
|
export declare function sponsoredStxTransfer(account: Account, recipient: string, amount: bigint, memo: string | undefined, network: Network): Promise<TransferResult>;
|
|
29
25
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* This is the primary entry point for services that need sponsored contract deployments.
|
|
26
|
+
* Build and submit a sponsored contract deploy via the relay.
|
|
27
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
34
28
|
*/
|
|
35
29
|
export declare function sponsoredContractDeploy(account: Account, options: ContractDeployOptions, network: Network): Promise<TransferResult>;
|
|
36
30
|
//# sourceMappingURL=sponsor-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsor-builder.d.ts","sourceRoot":"","sources":["../../src/transactions/sponsor-builder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sponsor-builder.d.ts","sourceRoot":"","sources":["../../src/transactions/sponsor-builder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAwDxG,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA8DD;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CAiBzB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CAczB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CAazB"}
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import { makeSTXTokenTransfer, makeContractCall, makeContractDeploy, PostConditionMode, } from "@stacks/transactions";
|
|
2
2
|
import { getStacksNetwork } from "../config/networks.js";
|
|
3
|
-
import { getSponsorRelayUrl, getSponsorApiKey } from "../config/sponsor.js";
|
|
3
|
+
import { getSponsorRelayUrl, getSponsorApiKey, isFallbackEnabled } from "../config/sponsor.js";
|
|
4
|
+
import { callContract, transferStx, deployContract } from "./builder.js";
|
|
5
|
+
import { recordNonceUsed } from "../services/nonce-tracker.js";
|
|
6
|
+
import { isRelayHealthy } from "../utils/relay-health.js";
|
|
7
|
+
/**
|
|
8
|
+
* Relay-side error codes and keywords that indicate a nonce conflict on the
|
|
9
|
+
* relay, not a user-side error. When these are present the tx itself is valid
|
|
10
|
+
* and a direct fallback makes sense.
|
|
11
|
+
*/
|
|
12
|
+
const NONCE_FAULT_PATTERNS = [
|
|
13
|
+
"ConflictingNonceInMempool",
|
|
14
|
+
"TooMuchChaining",
|
|
15
|
+
"BadNonce",
|
|
16
|
+
"nonce",
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when a failed relay response is caused by a relay-side nonce
|
|
20
|
+
* problem rather than a user-side error (bad args, insufficient balance, etc).
|
|
21
|
+
*/
|
|
22
|
+
function isRelayNonceFault(response) {
|
|
23
|
+
const code = response.code ?? "";
|
|
24
|
+
const error = response.error ?? "";
|
|
25
|
+
const details = response.details ?? "";
|
|
26
|
+
const haystack = `${code} ${error} ${details}`.toLowerCase();
|
|
27
|
+
return NONCE_FAULT_PATTERNS.some((p) => haystack.includes(p.toLowerCase()));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decide whether to fall back to direct submission for a relay failure.
|
|
31
|
+
* Returns { shouldFallback: true, reason } or { shouldFallback: false }.
|
|
32
|
+
*/
|
|
33
|
+
async function evaluateFallback(response, network) {
|
|
34
|
+
if (!isFallbackEnabled()) {
|
|
35
|
+
return { shouldFallback: false };
|
|
36
|
+
}
|
|
37
|
+
if (isRelayNonceFault(response)) {
|
|
38
|
+
return {
|
|
39
|
+
shouldFallback: true,
|
|
40
|
+
reason: `relay nonce error: ${response.code ?? response.error}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const healthy = await isRelayHealthy(network);
|
|
44
|
+
if (!healthy) {
|
|
45
|
+
return { shouldFallback: true, reason: "relay unhealthy" };
|
|
46
|
+
}
|
|
47
|
+
return { shouldFallback: false };
|
|
48
|
+
}
|
|
4
49
|
/**
|
|
5
50
|
* Format a failed SponsorRelayResponse into an error message
|
|
6
51
|
*/
|
|
@@ -26,81 +71,78 @@ function resolveSponsorApiKey(account) {
|
|
|
26
71
|
return apiKey;
|
|
27
72
|
}
|
|
28
73
|
/**
|
|
29
|
-
*
|
|
30
|
-
* return a TransferResult. Resolves the API key and handles relay errors.
|
|
74
|
+
* Submit a sponsored transaction to the relay and handle the response.
|
|
31
75
|
*
|
|
32
|
-
*
|
|
76
|
+
* Shared logic for all three sponsored helpers (contract call, STX transfer,
|
|
77
|
+
* contract deploy). Each caller builds its own transaction and provides a
|
|
78
|
+
* fallback function for direct submission when the relay is unavailable.
|
|
33
79
|
*/
|
|
34
|
-
|
|
80
|
+
async function submitSponsoredTransaction(account, transaction, network, directFallback) {
|
|
35
81
|
const apiKey = resolveSponsorApiKey(account);
|
|
36
|
-
const
|
|
82
|
+
const senderNonce = Number(transaction.auth.spendingCondition.nonce);
|
|
83
|
+
const serializedTx = transaction.serialize();
|
|
84
|
+
const response = await submitToSponsorRelay(serializedTx, network, apiKey);
|
|
85
|
+
if (!response.success) {
|
|
86
|
+
const { shouldFallback, reason } = await evaluateFallback(response, network);
|
|
87
|
+
if (shouldFallback) {
|
|
88
|
+
console.warn(`[sponsor] Relay unavailable or nonce error (${reason}), falling back to direct submission (sender pays fee)`);
|
|
89
|
+
const result = await directFallback();
|
|
90
|
+
return { ...result, fallback: true, fallbackReason: reason };
|
|
91
|
+
}
|
|
92
|
+
throw new Error(formatRelayError(response));
|
|
93
|
+
}
|
|
94
|
+
await recordNonceUsed(account.address, senderNonce, response.txid);
|
|
95
|
+
return { txid: response.txid, rawTx: serializedTx };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Build and submit a sponsored contract call via the relay.
|
|
99
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
100
|
+
*/
|
|
101
|
+
export async function sponsoredContractCall(account, options, network) {
|
|
37
102
|
const transaction = await makeContractCall({
|
|
38
103
|
contractAddress: options.contractAddress,
|
|
39
104
|
contractName: options.contractName,
|
|
40
105
|
functionName: options.functionName,
|
|
41
106
|
functionArgs: options.functionArgs,
|
|
42
107
|
senderKey: account.privateKey,
|
|
43
|
-
network:
|
|
108
|
+
network: getStacksNetwork(network),
|
|
44
109
|
postConditionMode: options.postConditionMode || PostConditionMode.Deny,
|
|
45
110
|
postConditions: options.postConditions || [],
|
|
46
111
|
sponsored: true,
|
|
47
112
|
fee: 0n,
|
|
48
113
|
});
|
|
49
|
-
|
|
50
|
-
const response = await submitToSponsorRelay(serializedTx, network, apiKey);
|
|
51
|
-
if (!response.success) {
|
|
52
|
-
throw new Error(formatRelayError(response));
|
|
53
|
-
}
|
|
54
|
-
return { txid: response.txid, rawTx: serializedTx };
|
|
114
|
+
return submitSponsoredTransaction(account, transaction, network, () => callContract(account, options));
|
|
55
115
|
}
|
|
56
116
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* This is the primary entry point for services that need sponsored STX transfers.
|
|
117
|
+
* Build and submit a sponsored STX transfer via the relay.
|
|
118
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
61
119
|
*/
|
|
62
120
|
export async function sponsoredStxTransfer(account, recipient, amount, memo, network) {
|
|
63
|
-
const apiKey = resolveSponsorApiKey(account);
|
|
64
|
-
const networkName = getStacksNetwork(network);
|
|
65
121
|
const transaction = await makeSTXTokenTransfer({
|
|
66
122
|
recipient,
|
|
67
123
|
amount,
|
|
68
124
|
senderKey: account.privateKey,
|
|
69
|
-
network:
|
|
125
|
+
network: getStacksNetwork(network),
|
|
70
126
|
memo: memo || "",
|
|
71
127
|
sponsored: true,
|
|
72
128
|
fee: 0n,
|
|
73
129
|
});
|
|
74
|
-
|
|
75
|
-
const response = await submitToSponsorRelay(serializedTx, network, apiKey);
|
|
76
|
-
if (!response.success) {
|
|
77
|
-
throw new Error(formatRelayError(response));
|
|
78
|
-
}
|
|
79
|
-
return { txid: response.txid, rawTx: serializedTx };
|
|
130
|
+
return submitSponsoredTransaction(account, transaction, network, () => transferStx(account, recipient, amount, memo));
|
|
80
131
|
}
|
|
81
132
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* This is the primary entry point for services that need sponsored contract deployments.
|
|
133
|
+
* Build and submit a sponsored contract deploy via the relay.
|
|
134
|
+
* Falls back to direct submission (sender pays fee) when the relay is unavailable.
|
|
86
135
|
*/
|
|
87
136
|
export async function sponsoredContractDeploy(account, options, network) {
|
|
88
|
-
const apiKey = resolveSponsorApiKey(account);
|
|
89
|
-
const networkName = getStacksNetwork(network);
|
|
90
137
|
const transaction = await makeContractDeploy({
|
|
91
138
|
contractName: options.contractName,
|
|
92
139
|
codeBody: options.codeBody,
|
|
93
140
|
senderKey: account.privateKey,
|
|
94
|
-
network:
|
|
141
|
+
network: getStacksNetwork(network),
|
|
95
142
|
sponsored: true,
|
|
96
143
|
fee: 0n,
|
|
97
144
|
});
|
|
98
|
-
|
|
99
|
-
const response = await submitToSponsorRelay(serializedTx, network, apiKey);
|
|
100
|
-
if (!response.success) {
|
|
101
|
-
throw new Error(formatRelayError(response));
|
|
102
|
-
}
|
|
103
|
-
return { txid: response.txid, rawTx: serializedTx };
|
|
145
|
+
return submitSponsoredTransaction(account, transaction, network, () => deployContract(account, options));
|
|
104
146
|
}
|
|
105
147
|
/**
|
|
106
148
|
* Submit a serialized transaction to the sponsor relay
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsor-builder.js","sourceRoot":"","sources":["../../src/transactions/sponsor-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,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IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,8BAA8B;YACnD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;IAED,OAAO,IAA4B,CAAC;AACtC,CAAC"}
|
|
@@ -9,6 +9,7 @@ export interface StuckTransaction {
|
|
|
9
9
|
txid: string;
|
|
10
10
|
nonce: number;
|
|
11
11
|
pendingSeconds: number;
|
|
12
|
+
sponsor_nonce?: number;
|
|
12
13
|
}
|
|
13
14
|
export interface RelayHealthStatus {
|
|
14
15
|
healthy: boolean;
|
|
@@ -29,6 +30,19 @@ export interface RelayHealthStatus {
|
|
|
29
30
|
stuckTransactions?: StuckTransaction[];
|
|
30
31
|
issues?: string[];
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Known sponsor addresses for each network.
|
|
35
|
+
* Only mainnet has a known relay sponsor address.
|
|
36
|
+
*/
|
|
37
|
+
export declare const SPONSOR_ADDRESSES: Partial<Record<Network, string>>;
|
|
38
|
+
/**
|
|
39
|
+
* Lightweight relay health probe — returns true only if the relay /health
|
|
40
|
+
* endpoint responds within 5 seconds with HTTP 200 and status "ok".
|
|
41
|
+
*
|
|
42
|
+
* Use this on the hot path (e.g., before deciding to fall back to direct
|
|
43
|
+
* submission) where the full checkRelayHealth() diagnostics are unnecessary.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isRelayHealthy(network: Network): Promise<boolean>;
|
|
32
46
|
/**
|
|
33
47
|
* Check relay health and sponsor nonce status
|
|
34
48
|
*/
|
|
@@ -57,9 +71,4 @@ export declare function attemptRbf(network: Network, txids?: string[], apiKey?:
|
|
|
57
71
|
* Gracefully returns { supported: false } if the relay returns 404 or 501.
|
|
58
72
|
*/
|
|
59
73
|
export declare function attemptFillGaps(network: Network, nonces?: number[], apiKey?: string): Promise<RelayRecoveryResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Wait with exponential backoff when relay nonce issues are detected
|
|
62
|
-
* Returns recommended wait time in milliseconds
|
|
63
|
-
*/
|
|
64
|
-
export declare function getRelayBackoffDelay(attempt: number, hasNonceGaps: boolean): number;
|
|
65
74
|
//# sourceMappingURL=relay-health.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-health.d.ts","sourceRoot":"","sources":["../../src/utils/relay-health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;
|
|
1
|
+
{"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AAM,EAAE,iBAAiB,GAAG,MAAM,CAuDzE;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAwDD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAW5G;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAWlH"}
|
|
@@ -10,9 +10,38 @@ import { getHiroApi } from "../services/hiro-api.js";
|
|
|
10
10
|
* Known sponsor addresses for each network.
|
|
11
11
|
* Only mainnet has a known relay sponsor address.
|
|
12
12
|
*/
|
|
13
|
-
const SPONSOR_ADDRESSES = {
|
|
13
|
+
export const SPONSOR_ADDRESSES = {
|
|
14
14
|
mainnet: "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Lightweight relay health probe — returns true only if the relay /health
|
|
18
|
+
* endpoint responds within 5 seconds with HTTP 200 and status "ok".
|
|
19
|
+
*
|
|
20
|
+
* Use this on the hot path (e.g., before deciding to fall back to direct
|
|
21
|
+
* submission) where the full checkRelayHealth() diagnostics are unnecessary.
|
|
22
|
+
*/
|
|
23
|
+
export async function isRelayHealthy(network) {
|
|
24
|
+
const relayUrl = getSponsorRelayUrl(network);
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
27
|
+
try {
|
|
28
|
+
const res = await fetch(`${relayUrl}/health`, {
|
|
29
|
+
method: "GET",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
signal: controller.signal,
|
|
32
|
+
});
|
|
33
|
+
if (!res.ok)
|
|
34
|
+
return false;
|
|
35
|
+
const data = await res.json();
|
|
36
|
+
return data.status === "ok";
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
16
45
|
/**
|
|
17
46
|
* Check relay health and sponsor nonce status
|
|
18
47
|
*/
|
|
@@ -95,6 +124,7 @@ export async function checkRelayHealth(network) {
|
|
|
95
124
|
txid: tx.tx_id,
|
|
96
125
|
nonce: tx.nonce,
|
|
97
126
|
pendingSeconds: nowSeconds - tx.receipt_time,
|
|
127
|
+
...(tx.sponsor_nonce !== undefined ? { sponsor_nonce: tx.sponsor_nonce } : {}),
|
|
98
128
|
}))
|
|
99
129
|
.sort((a, b) => b.pendingSeconds - a.pendingSeconds)
|
|
100
130
|
.slice(0, 10);
|
|
@@ -164,7 +194,7 @@ export function formatRelayHealthStatus(status) {
|
|
|
164
194
|
const minutes = Math.floor(tx.pendingSeconds / 60);
|
|
165
195
|
const seconds = tx.pendingSeconds % 60;
|
|
166
196
|
const duration = minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
|
|
167
|
-
lines.push(` nonce=${tx.nonce} pending=${duration} txid=${tx.txid}`);
|
|
197
|
+
lines.push(` nonce=${tx.nonce}${tx.sponsor_nonce !== undefined ? ` sponsor_nonce=${tx.sponsor_nonce}` : ""} pending=${duration} txid=${tx.txid}`);
|
|
168
198
|
});
|
|
169
199
|
}
|
|
170
200
|
if (status.issues && status.issues.length > 0) {
|
|
@@ -175,13 +205,13 @@ export function formatRelayHealthStatus(status) {
|
|
|
175
205
|
return lines.join("\n");
|
|
176
206
|
}
|
|
177
207
|
/**
|
|
178
|
-
*
|
|
179
|
-
* If txids is provided, only those transactions are bumped; otherwise the relay
|
|
180
|
-
* bumps all stuck transactions it knows about.
|
|
208
|
+
* Send a recovery request to the relay API.
|
|
181
209
|
*
|
|
182
|
-
*
|
|
210
|
+
* Shared implementation for RBF and gap-fill operations which differ only in
|
|
211
|
+
* path, request body, and the "unsupported" message shown when the relay
|
|
212
|
+
* returns 404 or 501.
|
|
183
213
|
*/
|
|
184
|
-
|
|
214
|
+
async function relayRecoveryRequest(network, relayPath, body, unsupportedMessage, apiKey) {
|
|
185
215
|
const relayUrl = getSponsorRelayUrl(network);
|
|
186
216
|
const resolvedKey = apiKey || getSponsorApiKey();
|
|
187
217
|
if (!resolvedKey) {
|
|
@@ -190,32 +220,24 @@ export async function attemptRbf(network, txids, apiKey) {
|
|
|
190
220
|
message: "No sponsor API key available. Set SPONSOR_API_KEY env var or use a wallet with sponsorApiKey configured.",
|
|
191
221
|
};
|
|
192
222
|
}
|
|
193
|
-
const headers = {
|
|
194
|
-
"Content-Type": "application/json",
|
|
195
|
-
"Authorization": `Bearer ${resolvedKey}`,
|
|
196
|
-
};
|
|
197
|
-
const body = {};
|
|
198
|
-
if (txids && txids.length > 0) {
|
|
199
|
-
body.txids = txids;
|
|
200
|
-
}
|
|
201
223
|
const controller = new AbortController();
|
|
202
224
|
const timeout = setTimeout(() => controller.abort(), 30000);
|
|
203
225
|
try {
|
|
204
|
-
const res = await fetch(`${relayUrl}
|
|
226
|
+
const res = await fetch(`${relayUrl}${relayPath}`, {
|
|
205
227
|
method: "POST",
|
|
206
|
-
headers
|
|
228
|
+
headers: {
|
|
229
|
+
"Content-Type": "application/json",
|
|
230
|
+
"Authorization": `Bearer ${resolvedKey}`,
|
|
231
|
+
},
|
|
207
232
|
body: JSON.stringify(body),
|
|
208
233
|
signal: controller.signal,
|
|
209
234
|
});
|
|
210
235
|
if (res.status === 404 || res.status === 501) {
|
|
211
|
-
return {
|
|
212
|
-
supported: false,
|
|
213
|
-
message: "Relay does not support RBF recovery yet. Share stuck txids with the AIBTC team for manual recovery.",
|
|
214
|
-
};
|
|
236
|
+
return { supported: false, message: unsupportedMessage };
|
|
215
237
|
}
|
|
216
238
|
if (!res.ok) {
|
|
217
239
|
const text = await res.text();
|
|
218
|
-
throw new Error(`Relay
|
|
240
|
+
throw new Error(`Relay ${relayPath} failed: HTTP ${res.status} — ${text}`);
|
|
219
241
|
}
|
|
220
242
|
const result = await res.json();
|
|
221
243
|
return { supported: true, result };
|
|
@@ -225,66 +247,28 @@ export async function attemptRbf(network, txids, apiKey) {
|
|
|
225
247
|
}
|
|
226
248
|
}
|
|
227
249
|
/**
|
|
228
|
-
* Attempt
|
|
229
|
-
* If
|
|
250
|
+
* Attempt RBF (replace-by-fee) on stuck transactions via the relay API.
|
|
251
|
+
* If txids is provided, only those transactions are bumped; otherwise the relay
|
|
252
|
+
* bumps all stuck transactions it knows about.
|
|
230
253
|
*
|
|
231
254
|
* Gracefully returns { supported: false } if the relay returns 404 or 501.
|
|
232
255
|
*/
|
|
233
|
-
export
|
|
234
|
-
const relayUrl = getSponsorRelayUrl(network);
|
|
235
|
-
const resolvedKey = apiKey || getSponsorApiKey();
|
|
236
|
-
if (!resolvedKey) {
|
|
237
|
-
return {
|
|
238
|
-
supported: true,
|
|
239
|
-
message: "No sponsor API key available. Set SPONSOR_API_KEY env var or use a wallet with sponsorApiKey configured.",
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
const headers = {
|
|
243
|
-
"Content-Type": "application/json",
|
|
244
|
-
"Authorization": `Bearer ${resolvedKey}`,
|
|
245
|
-
};
|
|
256
|
+
export function attemptRbf(network, txids, apiKey) {
|
|
246
257
|
const body = {};
|
|
247
|
-
if (
|
|
248
|
-
body.
|
|
249
|
-
|
|
250
|
-
const controller = new AbortController();
|
|
251
|
-
const timeout = setTimeout(() => controller.abort(), 30000);
|
|
252
|
-
try {
|
|
253
|
-
const res = await fetch(`${relayUrl}/recovery/fill-gaps`, {
|
|
254
|
-
method: "POST",
|
|
255
|
-
headers,
|
|
256
|
-
body: JSON.stringify(body),
|
|
257
|
-
signal: controller.signal,
|
|
258
|
-
});
|
|
259
|
-
if (res.status === 404 || res.status === 501) {
|
|
260
|
-
return {
|
|
261
|
-
supported: false,
|
|
262
|
-
message: "Relay does not support nonce gap-fill recovery yet. Share missing nonces with the AIBTC team for manual recovery.",
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
if (!res.ok) {
|
|
266
|
-
const text = await res.text();
|
|
267
|
-
throw new Error(`Relay gap-fill failed: HTTP ${res.status} — ${text}`);
|
|
268
|
-
}
|
|
269
|
-
const result = await res.json();
|
|
270
|
-
return { supported: true, result };
|
|
271
|
-
}
|
|
272
|
-
finally {
|
|
273
|
-
clearTimeout(timeout);
|
|
274
|
-
}
|
|
258
|
+
if (txids && txids.length > 0)
|
|
259
|
+
body.txids = txids;
|
|
260
|
+
return relayRecoveryRequest(network, "/recovery/rbf", body, "Relay does not support RBF recovery yet. Share stuck txids with the AIBTC team for manual recovery.", apiKey);
|
|
275
261
|
}
|
|
276
262
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
263
|
+
* Attempt to fill nonce gaps on the relay by having it submit placeholder transactions.
|
|
264
|
+
* If nonces is provided, only those gaps are filled; otherwise the relay fills all detected gaps.
|
|
265
|
+
*
|
|
266
|
+
* Gracefully returns { supported: false } if the relay returns 404 or 501.
|
|
279
267
|
*/
|
|
280
|
-
export function
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
// Normal backoff: 2s, 5s, 10s
|
|
287
|
-
const delays = [2000, 5000, 10000];
|
|
288
|
-
return delays[Math.min(attempt, delays.length - 1)];
|
|
268
|
+
export function attemptFillGaps(network, nonces, apiKey) {
|
|
269
|
+
const body = {};
|
|
270
|
+
if (nonces && nonces.length > 0)
|
|
271
|
+
body.nonces = nonces;
|
|
272
|
+
return relayRecoveryRequest(network, "/recovery/fill-gaps", body, "Relay does not support nonce gap-fill recovery yet. Share missing nonces with the AIBTC team for manual recovery.", apiKey);
|
|
289
273
|
}
|
|
290
274
|
//# sourceMappingURL=relay-health.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-health.js","sourceRoot":"","sources":["../../src/utils/relay-health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"relay-health.js","sourceRoot":"","sources":["../../src/utils/relay-health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA6BrD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqC;IACjE,OAAO,EAAE,0CAA0C;CACpD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAgB;IACnD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;IAE3D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,SAAS,EAAE;YAC5C,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC;QAE1B,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAyB,CAAC;QACrD,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M,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,KAAgB,EAAE,MAAe;IAC5E,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAElD,OAAO,oBAAoB,CACzB,OAAO,EACP,eAAe,EACf,IAAI,EACJ,qGAAqG,EACrG,MAAM,CACP,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB,EAAE,MAAiB,EAAE,MAAe;IAClF,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAEtD,OAAO,oBAAoB,CACzB,OAAO,EACP,qBAAqB,EACrB,IAAI,EACJ,mHAAmH,EACnH,MAAM,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibtc/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"description": "Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg, NFTs, and x402 payments.",
|
|
5
5
|
"mcpName": "io.github.aibtcdev/mcp-server",
|
|
6
6
|
"type": "module",
|
package/skill/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Bitcoin L1 wallet for agents - check balances, send BTC, manage UTX
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: aibtcdev
|
|
7
|
-
version: 1.
|
|
7
|
+
version: 1.45.0 # x-release-please-version
|
|
8
8
|
npm: "@aibtc/mcp-server"
|
|
9
9
|
github: https://github.com/aibtcdev/aibtc-mcp-server
|
|
10
10
|
---
|