@subly_fi/pay 0.1.0 → 0.1.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/dist/deposit.js +5 -15
- package/dist/mcp-server.js +6 -22
- package/dist/withdraw.js +5 -15
- package/package.json +1 -1
package/dist/deposit.js
CHANGED
|
@@ -1103,11 +1103,7 @@ async function loadKeyPairSigner(params) {
|
|
|
1103
1103
|
|
|
1104
1104
|
// ../../src/solana/rpc.ts
|
|
1105
1105
|
import { createSolanaRpc } from "@solana/kit";
|
|
1106
|
-
function
|
|
1107
|
-
const url = env.SOLANA_RPC_URL;
|
|
1108
|
-
if (url === void 0 || url.length === 0) {
|
|
1109
|
-
throw new Error("SOLANA_RPC_URL must be configured");
|
|
1110
|
-
}
|
|
1106
|
+
function createRpc(url) {
|
|
1111
1107
|
return createSolanaRpc(url);
|
|
1112
1108
|
}
|
|
1113
1109
|
|
|
@@ -1116,13 +1112,6 @@ function fail(message) {
|
|
|
1116
1112
|
console.error(message);
|
|
1117
1113
|
process.exit(1);
|
|
1118
1114
|
}
|
|
1119
|
-
function requireEnv(name) {
|
|
1120
|
-
const value = process.env[name];
|
|
1121
|
-
if (value === void 0 || value.length === 0) {
|
|
1122
|
-
fail(`Missing required environment variable: ${name}`);
|
|
1123
|
-
}
|
|
1124
|
-
return value;
|
|
1125
|
-
}
|
|
1126
1115
|
function formatRawUsdc(raw) {
|
|
1127
1116
|
const units = BigInt(raw);
|
|
1128
1117
|
const whole = units / 1000000n;
|
|
@@ -1131,8 +1120,7 @@ function formatRawUsdc(raw) {
|
|
|
1131
1120
|
}
|
|
1132
1121
|
|
|
1133
1122
|
// ../../demo/deposit.ts
|
|
1134
|
-
|
|
1135
|
-
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "http://localhost:3000";
|
|
1123
|
+
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "https://api.demo.sublyfi.com";
|
|
1136
1124
|
var amountRawUsdc = process.argv[2];
|
|
1137
1125
|
if (amountRawUsdc === void 0 || !/^[1-9]\d*$/.test(amountRawUsdc)) {
|
|
1138
1126
|
fail(
|
|
@@ -1145,7 +1133,9 @@ var keyPairSigner = await loadKeyPairSigner({
|
|
|
1145
1133
|
label: "SUBLY_DEMO_AGENT_KEYPAIR"
|
|
1146
1134
|
});
|
|
1147
1135
|
var signer = new LocalKeypairAgentWalletSigner(keyPairSigner);
|
|
1148
|
-
var rpc =
|
|
1136
|
+
var rpc = createRpc(
|
|
1137
|
+
process.env.SOLANA_RPC_URL ?? "https://api.mainnet-beta.solana.com"
|
|
1138
|
+
);
|
|
1149
1139
|
async function postJson(path, body) {
|
|
1150
1140
|
const url = `${facilitatorBaseUrl}${path}`;
|
|
1151
1141
|
const serialized = JSON.stringify(body);
|
package/dist/mcp-server.js
CHANGED
|
@@ -1469,11 +1469,7 @@ async function loadKeyPairSigner(params) {
|
|
|
1469
1469
|
|
|
1470
1470
|
// ../../src/solana/rpc.ts
|
|
1471
1471
|
import { createSolanaRpc } from "@solana/kit";
|
|
1472
|
-
function
|
|
1473
|
-
const url = env.SOLANA_RPC_URL;
|
|
1474
|
-
if (url === void 0 || url.length === 0) {
|
|
1475
|
-
throw new Error("SOLANA_RPC_URL must be configured");
|
|
1476
|
-
}
|
|
1472
|
+
function createRpc(url) {
|
|
1477
1473
|
return createSolanaRpc(url);
|
|
1478
1474
|
}
|
|
1479
1475
|
|
|
@@ -1652,24 +1648,10 @@ var SublyX402Client = class {
|
|
|
1652
1648
|
}
|
|
1653
1649
|
};
|
|
1654
1650
|
|
|
1655
|
-
// ../../demo/shared.ts
|
|
1656
|
-
function fail(message) {
|
|
1657
|
-
console.error(message);
|
|
1658
|
-
process.exit(1);
|
|
1659
|
-
}
|
|
1660
|
-
function requireEnv(name) {
|
|
1661
|
-
const value = process.env[name];
|
|
1662
|
-
if (value === void 0 || value.length === 0) {
|
|
1663
|
-
fail(`Missing required environment variable: ${name}`);
|
|
1664
|
-
}
|
|
1665
|
-
return value;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
1651
|
// ../../demo/mcp-server.ts
|
|
1669
1652
|
var TOOL_NAME = "fetch_with_subly_payment";
|
|
1670
1653
|
var DEFAULT_MAX_AMOUNT_RAW_USDC = 10000n;
|
|
1671
|
-
|
|
1672
|
-
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "http://localhost:3000";
|
|
1654
|
+
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "https://api.demo.sublyfi.com";
|
|
1673
1655
|
var defaultMaxAmountRawUsdc = process.env.SUBLY_MCP_MAX_AMOUNT_RAW_USDC === void 0 ? DEFAULT_MAX_AMOUNT_RAW_USDC : BigInt(process.env.SUBLY_MCP_MAX_AMOUNT_RAW_USDC);
|
|
1674
1656
|
var keyPairSigner = await loadKeyPairSigner({
|
|
1675
1657
|
base58Secret: process.env.SUBLY_DEMO_AGENT_KEYPAIR,
|
|
@@ -1677,7 +1659,9 @@ var keyPairSigner = await loadKeyPairSigner({
|
|
|
1677
1659
|
label: "SUBLY_DEMO_AGENT_KEYPAIR"
|
|
1678
1660
|
});
|
|
1679
1661
|
var signer = new LocalKeypairAgentWalletSigner(keyPairSigner);
|
|
1680
|
-
var rpc =
|
|
1662
|
+
var rpc = createRpc(
|
|
1663
|
+
process.env.SOLANA_RPC_URL ?? "https://api.mainnet-beta.solana.com"
|
|
1664
|
+
);
|
|
1681
1665
|
async function fetchBudget() {
|
|
1682
1666
|
try {
|
|
1683
1667
|
const url = `${facilitatorBaseUrl}/v1/wallets/${signer.walletAddress}/budget`;
|
|
@@ -1764,7 +1748,7 @@ Before payments can succeed the operator of this server must have, once:
|
|
|
1764
1748
|
|
|
1765
1749
|
Then use fetch_with_subly_payment(url) to GET a paid resource: it pays the 402 from yield and returns the body plus an on-chain receipt. If it returns insufficient_yield, that is expected \u2014 wait for yield, do not loop. If it returns delivery_failed_payment_pending, call the SAME url again (it retries the same payment, never double-pays).`;
|
|
1766
1750
|
var server = new Server(
|
|
1767
|
-
{ name: "subly-payments", version: "0.1.
|
|
1751
|
+
{ name: "subly-payments", version: "0.1.1" },
|
|
1768
1752
|
{ capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS }
|
|
1769
1753
|
);
|
|
1770
1754
|
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
package/dist/withdraw.js
CHANGED
|
@@ -1046,11 +1046,7 @@ async function loadKeyPairSigner(params) {
|
|
|
1046
1046
|
|
|
1047
1047
|
// ../../src/solana/rpc.ts
|
|
1048
1048
|
import { createSolanaRpc } from "@solana/kit";
|
|
1049
|
-
function
|
|
1050
|
-
const url = env.SOLANA_RPC_URL;
|
|
1051
|
-
if (url === void 0 || url.length === 0) {
|
|
1052
|
-
throw new Error("SOLANA_RPC_URL must be configured");
|
|
1053
|
-
}
|
|
1049
|
+
function createRpc(url) {
|
|
1054
1050
|
return createSolanaRpc(url);
|
|
1055
1051
|
}
|
|
1056
1052
|
|
|
@@ -1059,13 +1055,6 @@ function fail(message) {
|
|
|
1059
1055
|
console.error(message);
|
|
1060
1056
|
process.exit(1);
|
|
1061
1057
|
}
|
|
1062
|
-
function requireEnv(name) {
|
|
1063
|
-
const value = process.env[name];
|
|
1064
|
-
if (value === void 0 || value.length === 0) {
|
|
1065
|
-
fail(`Missing required environment variable: ${name}`);
|
|
1066
|
-
}
|
|
1067
|
-
return value;
|
|
1068
|
-
}
|
|
1069
1058
|
function formatRawUsdc(raw) {
|
|
1070
1059
|
const units = BigInt(raw);
|
|
1071
1060
|
const whole = units / 1000000n;
|
|
@@ -1074,8 +1063,7 @@ function formatRawUsdc(raw) {
|
|
|
1074
1063
|
}
|
|
1075
1064
|
|
|
1076
1065
|
// ../../demo/withdraw.ts
|
|
1077
|
-
|
|
1078
|
-
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "http://localhost:3000";
|
|
1066
|
+
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "https://api.demo.sublyfi.com";
|
|
1079
1067
|
var amountRawUsdc = process.argv[2];
|
|
1080
1068
|
if (amountRawUsdc === void 0 || !/^[1-9]\d*$/.test(amountRawUsdc)) {
|
|
1081
1069
|
fail(
|
|
@@ -1088,7 +1076,9 @@ var keyPairSigner = await loadKeyPairSigner({
|
|
|
1088
1076
|
label: "SUBLY_DEMO_AGENT_KEYPAIR"
|
|
1089
1077
|
});
|
|
1090
1078
|
var signer = new LocalKeypairAgentWalletSigner(keyPairSigner);
|
|
1091
|
-
var rpc =
|
|
1079
|
+
var rpc = createRpc(
|
|
1080
|
+
process.env.SOLANA_RPC_URL ?? "https://api.mainnet-beta.solana.com"
|
|
1081
|
+
);
|
|
1092
1082
|
async function postJson(path, body) {
|
|
1093
1083
|
const url = `${facilitatorBaseUrl}${path}`;
|
|
1094
1084
|
const serialized = JSON.stringify(body);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subly_fi/pay",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Subly client: pay for x402 (subly-yield-exact) HTTP resources from Kamino vault yield. Ships an MCP server and a one-shot pay/deposit CLI; non-custodial (signs locally with your own key).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|